local animations = {}
local activeFrame
local currentFrame = 1
function love.load()
animations[1] = love.graphics.newImage("512px-Kirby.png")
animations[2] = love.graphics.newImage("kirby.png")
activeFrame = animations[currentFrame]
end
function love.update(dt)
end
function love.draw()
love.graphics.draw(animations[1], love.graphics.getWidth () / 2, love.graphics.getHeight () / 2, 0, 0.2, 0.2, 256, 239.5)
love.graphics.draw(animations[2], love.graphics.getWidth () / 2, love.graphics.getHeight () / 2, 0, 0.2, 0.2, 531.5, 414.5)
--Loads the png into the image variable.
end
--In Lua all values are true except false and nil, therefore every variable needs to be defined previously in order to not return an error.
local elapsedTime = 0
function love.update(dt)
elapsedTime = elapsedTime + dt
if(elapsedTime > 1) then
if(currentFrame < 2) then
currentFrame = currentFrame + 1
else
currentFrame = 1
end
activeFrame = animations[currentFrame]
elapsedTime = 0
end
end
bG9jYWwgYW5pbWF0aW9ucyA9IHt9CmxvY2FsIGFjdGl2ZUZyYW1lCmxvY2FsIGN1cnJlbnRGcmFtZSA9IDEKCmZ1bmN0aW9uIGxvdmUubG9hZCgpCiAgYW5pbWF0aW9uc1sxXSAgPSBsb3ZlLmdyYXBoaWNzLm5ld0ltYWdlKCI1MTJweC1LaXJieS5wbmciKQogIGFuaW1hdGlvbnNbMl0gPSBsb3ZlLmdyYXBoaWNzLm5ld0ltYWdlKCJraXJieS5wbmciKQogIGFjdGl2ZUZyYW1lID0gYW5pbWF0aW9uc1tjdXJyZW50RnJhbWVdCmVuZAoKZnVuY3Rpb24gbG92ZS51cGRhdGUoZHQpCiAgCmVuZAoKZnVuY3Rpb24gbG92ZS5kcmF3KCkKICBsb3ZlLmdyYXBoaWNzLmRyYXcoYW5pbWF0aW9uc1sxXSwgbG92ZS5ncmFwaGljcy5nZXRXaWR0aCAoKSAvIDIsIGxvdmUuZ3JhcGhpY3MuZ2V0SGVpZ2h0ICgpIC8gMiwgMCwgMC4yLCAwLjIsIDI1NiwgMjM5LjUpCiAgbG92ZS5ncmFwaGljcy5kcmF3KGFuaW1hdGlvb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