Last active
July 29, 2022 17:11
-
-
Save GarethIW/4f5a0215300d41f814194e9a96cc2a4f to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import "CoreLibs/graphics" | |
import "CoreLibs/crank" | |
local numFrames=55 | |
local frames={} | |
local currentFrame=1 | |
playdate.display.setRefreshRate(50) | |
for i=1,numFrames do | |
table.insert(frames, playdate.graphics.image.new("images/frame ("..i..")")) | |
end | |
function playdate.update() | |
playdate.graphics.setColor(playdate.graphics.kColorBlack) | |
playdate.graphics.fillRect(0, 0, playdate.display.getWidth(), playdate.display.getHeight()) | |
frames[currentFrame]:draw(0,8) | |
end | |
function playdate.cranked(change, acceleratedChange) | |
currentFrame+=playdate.getCrankTicks(10) | |
if currentFrame<1 then currentFrame=1 end -- why u no math.clamp() lua? | |
if currentFrame>numFrames then currentFrame=numFrames end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment