This is the code that I have so far:
Code: Select all
require("AnAL")
SPRITE_WIDTH = 32
SPRITE_HEIGHT = 48
function love.load()
img = love.graphics.newImage("sprites/chikaru.png")
spr = newAnimation(img, SPRITE_WIDTH, SPRITE_HEIGHT, 0.2, 0)
spr:seek(3)
end
function love.update(dt)
if love.keyboard.isDown("left") then
spr:seek(3)
x = x - 100
spr:update(dt)
end
if love.keyboard.isDown("right") then
spr:seek(7)
x = x + 100
spr:update(dt)
end
if love.keyboard.isDown("up") then
spr:seek(11)
y = y - 100
spr.update(dt)
end
if love.keyboard.isDown("down") then
spr.seek(15)
y = y + 100
spr.update(dt)
end
end
function love.draw()
love.graphics.draw(spr, x, y)
end