Use the Spacekey to jump
Use the left and right arrow keys to move
`screen settings
gamestart:
sync on
sync rate 40
hide mouse
`make a player pawn
make object sphere 1,5
color object 1,rgb(0,255,255)
set object collision to spheres 1
yrotate object 1,wrapvalue(object angle y(1)+90)
make object sphere 1000,5
color object 1000,rgb(0,255,255)
lock object on 1000
position object 1000,-95,70,125
`make the main platform
make object box 2,100,5,7
position object 2,object position x(2)+50,object position y(2)-50,object position z(2)
set object collision to boxes 2
set object collision on 2
make object box 300,6,300,7
position object 300,object position x(300)-6,object position y(300)+100,object position z(300)
make object box 301,6,300,7
position object 301,object position x(301)+106,object position y(301)+100,object position z(301)
`make lower platforms
for x=3 to 53
make object box x,7,3,3
position object x,rnd(100),rnd(200)-46,object position z(2)
color object x,rgb(rnd(155)+100,rnd(155)+100,rnd(155)+100)
next x
position camera 50,-35,-120
jumptime=0
lives=3
gosub game
game:
od=53
position object 300,-6,100,object position z(300)
for x=3 to 53
position object x,rnd(100),rnd(200)-46,object position z(2)
next x
position object 301,106,100,object position z(301)
position object 1,50,-45,0
position camera 50,-35,-120
`main loop
do
for x=3 to 53
if object screen x(x)>0
y=object screen y(x)
if y>480
position object x,rnd(100),object position y(x)+200,object position z(2)
endif
endif
next x
x#=object position x(1)
`determine if object is in the air
if air=1 then position object 1,object position x(1),object position y(1)-3,object position z(1)
if object collision(1,0)>0 then air=0
if object collision(1,0)=0 then air=1
`determine if it is jumping
if jump=1 and jumptime<25
inc jumptime
air=0
position object 1,object position x(1),object position y(1)+3,object position z(1)
if object position y(1)=>object position y(2)+25 and jumptime=25
jumptime=0
jump=0
air=1
endif
endif
`accept keyboard input
if leftkey()=1
move object 1,-2
if object collision(1,300)=1 then move object 1,2
endif
if rightkey()=1
move object 1,2
if object collision(1,301)=1 then move object 1,-2
endif
if spacekey()=1 and jump=0 and air=0 then jump=1
inc score
center text 320,10,str$(score)
center text 40,10,"="+str$(lives)
`set the position of the camera
position camera camera position x(), camera position y()+1, camera position z()
y#=object screen y(1)
if object in screen(2)=0
position object 300,object position x(300),object position y(300)+1,object position z(300)
position object 301,object position x(301),object position y(301)+1,object position z(301)
endif
if y#<0 then position object 1, object position x(1), object position y(1)-1, object position z(1)
if y#>480
dec lives
if lives<=0
score=0
lives=3
gosub YOULOSE
endif
gosub game
endif
`refresh the screen
sync
`end the main loop
loop
return
YOULOSE:
cls rgb(0,0,0):ink rgb(255,0,0),0:for o=1 to 1000:if object exist(o)=1 then delete object o
next o:backdrop off:set text size 50:center text 320,180,"YOU LOSE":center text 320,280,"Press any key to try again":suspend for key:set text size 10:backdrop on:ink rgb(255,255,255),0:gosub gamestart:return