-- EVILMANA.COM PSP LUA CODEBASE
-- www.evilmana.com/tutorials/codebase
-- Jump Script
-- SUBMITTED BY: bronxbomber92
playerImage = Image.createEmpty(32, 32)
white = Color.new(255,255,255)
playerImage:clear(white)
player = {}
player.x = 20
player.y = 200
player.image = playerImage
at=1 --Air Time--
aj=0 --Active Jump--
r=0 --Ready (To Jump)--
z = 1 -- "1" equals right, "2" equal left.
function jump()
if aj==0 and math.abs(player.y) > 199 then
r=1 else r=0
end
if pad:circle() and r==1 then
aj=1
end
if aj==1 and math.abs(at) < 100 and z==1 then
player.y = player.y-5
at=at+1
elseif aj==1 and math.abs(at) < 100 and z==2 then
player.y = player.y-5
at=at+1
end
if at==20 then
aj=0
at=1
end
if aj==0 and math.abs(player.y) < 200 then
player.y=player.y+6
end
if z == 1 then
screen:blit(player.x, player.y,player.image)
elseif z == 2 then
screen:blit(player.x, player.y,player.image)
end
end
while true do
screen:clear()
pad = Controls.read() -- nessecary to read button input
jump()
screen.flip()
screen.waitVblankStart()
end