ok, i have this really simple jump theory, here is the code with the animation and the problem is that it doesn't come back down when prompted to
Code:
standright = Image.load("images/jack/jackstandright.png")
jump = Image.load("images/jack/jackjumpright1.png")
jump2 = Image.load("images/jack/jackjumpright2.png")
jump3 = Image.load("images/jack/jackjumpright3.png")
player = {}
player.x = 20
player.y = 200
player.img = standright
Timer1 = 0
function jumpright()
Timer1 = Timer1 + 1
if Timer1==5 then
player.img = jump
end
if Timer1==10 then
player.img = jump2
end
if Timer1==15 then
player.img = jump3
end
while true do ----MAIN LOOP----
oldx = player.x
oldy = player.y
screen:clear()
pad = Controls.read()
if pad:up() then
jumpright()
player.y = player.y + 10 --player y is 20 so if you add it it will go 30
end
if pad:up() and player.y == 30 then
--since player y is 30 because of the last loop, i want it to come back down to 20
player.y = player.y + 10
end
screen:blit(player.x, player.y, player.img)
screen.flip()
oldpad = pad
screen.waitVblankStart()
end
also, when the animatin stops, it won't clear the scrren and replaye it with player.img, even with the running animation