Submit Your Own Code

PSP Lua CodeBase : Jump Script

Description:
This is a jumping script with all necessary variables. Please contact me if you do no understand it via bronxbomber92[at]yahoo[dot]com

 
 -- 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

Back to CodeBase
 

Please welcome jramada, our newest member.

Who's Online: 5 Guests, 0 Users

Total Members: 555
Total Posts: 13057
Total Topics: 1480
Total Categories: 8
Total Boards: 35

Recent Posts:

Re: Lua Loader? by osgeld
Re: Lua Loader? by acer5050
Re: Lua Loader? by bumuckl
Re: Lua Loader? by acer5050
Re: Lua Loader? by bumuckl
Lua Loader? by acer5050
Re: PGELua Help - need term for a special rotation fix (mathematical issue) by bumuckl
Re: PGELua Help - need term for a special rotation fix (mathematical issue) by tacticalpenguin


Copyright © 2006-2007 www.EvilMana.com All rights reserved.
EvilMana Logo by emcp and Charlie