function round(number) local formatted = string.format("%.2f", number) return formatted end function screenShake(shakeTime, shakeMagnitude) local shakeTimer = playdate.timer.new(shakeTime, shakeMagnitude, 0) shakeTimer.updateCallback = function(timer) local magnitude = math.floor(timer.value) local shakeX = math.random(-magnitude, magnitude) local shakeY = math.random(-magnitude, magnitude) playdate.display.setOffset(shakeX, shakeY) end shakeTimer.timerEndedCallback = function() playdate.display.setOffset(0, 0) end end