-- EVILMANA.COM PSP LUA CODEBASE
-- www.evilmana.com/tutorials/codebase
-- Simple Animation
-- SUBMITTED BY: cwirsing
-- Load Images Into A Table
animation = {}
for a = 1, 5 do
animation[a] = Image.load("animation" ..a..".png")
end
-- Player Info
player = {}
player.x = 220
player.y = 110
player.pad = "none"
-- Set Default Image
animation1 = anim
-- Set loop count
loopCount = 0
-- Read Controls
while true do
pad = Controls.read()
screen:clear()
-- Animation Loop
if pad:cross() then
if loopCount >= 0 and loopCount < 6 then anim = animation[1]
elseif loopCount >= 6 and loopCount < 12 then anim = animation[2]
elseif loopCount >= 12 and loopCount < 18 then anim = animation[3]
elseif loopCount >= 18 and loopCount < 24 then anim = animation[4]
elseif loopCount >= 24 and loopCount < 30 then anim = animation[5] end
if loopCount + 1 >= 30 then loopCount = 0 else loopCount = loopCount + 1 end
end
-- Display Default Image
screen:blit(player.x,player.y,anim)
-- End Loop
screen.waitVblankStart()
screen.flip()
end