I might try to add love2d reference but probably not a good idea
Edit: I noticed that the animation example is flickering and the sample image is too small
Edit: animation example could have been simpler
Code: Select all
function love.load()
image = love.graphics.newImage("assets/anim-boogie.png")
local sw, sh = image:getDimensions()
frames = {
love.graphics.newQuad( 0, 0, 32, 32, sw, sh),
love.graphics.newQuad(32, 0, 32, 32, sw, sh),
love.graphics.newQuad(64, 0, 32, 32, sw, sh),
love.graphics.newQuad( 0, 32, 32, 32, sw, sh),
love.graphics.newQuad(32, 32, 32, 32, sw, sh),
love.graphics.newQuad(64, 32, 32, 32, sw, sh)
}
frameindex = 1
time = 0
end
function love.draw()
love.graphics.draw(image, frames[frameindex], 100, 100)
end
function love.update(dt)
time = time + dt
frameindex = math.floor(time * 10) % #frames + 1
end