my god, 24 hours, 20 lines, and
another game!
this one is a platform-jumping game where you collect colored
spheres from rooftops. avoid the black sentry cubes, and don't fall too far!
randomize timer() : set display mode 800,600,32 : sync on : sync rate 30 : sync : set text size 30 : set text to bold : hide mouse : make object SPHERE 1,5 : create bitmap 1,4,4 : ink rgb(255,0,0),0 : box 0,0,3,3 : get image 5,0,0,3,3 : delete bitmap 1 : texture object 1,5 : make light 1
start_game: : center text 400,10,"HIGHER GROUND" : center text 400,40,"(press any key to play)" : center text 400,100,"MOVE" : center text 400,130,"forward and back with the UP and DOWN arrow keys." : center text 400,160,"TURN" : center text 400,190,"left and right with the LEFT and RIGHT arrow keys." : center text 400,220,"JUMP" : center text 400,250,"with the SHIFT key" : life=3 : score=0 : falling=0 : ouch=0 : level=0 : hite=55 : nme=2
center text 400,280,"COLLECT" : center text 400,310,"the colored spheres from the tops of buildings." : center text 400,340,"SCORE" : center text 400,370,"more points for higher spheres." : center text 400,400,"AVOID" : center text 400,430,"the black cube sentries." : center text 400,460,"DON'T" : center text 400,490,"fall too far." : center text 400,520,"PROCEED" : center text 400,550,"to the next level by pressing any 'number' key." : SYNC : wait key
start_new_level: : inc level : nme=nme+4 : for t=2 to 1999 : if object exist (t) : delete object t : endif : next t : create bitmap 1,64,64 : ink rgb(0,0,rnd(200)+55),0 : box 0,0,63,63 : ink rgb(255,255,255),0 : for t = 1 to 30 : x=rnd(60) : y=rnd(60) : box x,y,x+3+rnd(15),y+3+rnd(5) : next t : blur bitmap 1,3 : get image 1,0,0,63,63 : delete bitmap 1 : make object sphere 999,1600 : set object cull 999,0 : set object light 999,0 : set object collision off 999 : texture object 999,1
create bitmap 1,20,20 : x=rnd(200)+50 : ink rgb(x,x,x),0 : box 0,0,19,19 : for t=1 to 5 : x=rnd(100)+10 : ink rgb(x,x,x),0 : y=rnd(16) : z=rnd(16) : box y,z,y+3+rnd(2),z+3+rnd(2) : next t : for t=0 to 19 step 4 : x=rnd(200)+50 : ink rgb(x,x,x),0 : y=rnd(2)+1 : box 0,t,19,t+y : next t : get image 2,0,0,19,19 : delete bitmap 1
if matrix exist(1) : delete matrix 1 : endif : create bitmap 1,10,10 : for x=0 to 9 : for y=0 to 9 : z=rnd(255) : ink rgb(z,z,z),0 : dot x,y : next y : next x : get image 3,0,0,9,9 : delete bitmap 1 : make matrix 1,800,800,15,15 : prepare matrix texture 1,3,1,1 : fill matrix 1,0,1 : POSITION MATRIX 1,-200,0,-200 : update matrix 1 : dim x(10) as float : dim y(10) as float : dim z(10) as float :
numobj=99 : for x=1 to 20 : for y=1 to 20 : if rnd(2)=1 : inc numobj : make object box numobj,20,rnd(hite)+5,20 : texture object numobj,2 : position object numobj,x*20,(object size y(numobj)/2),y*20 : make object sphere numobj+1000,5 : position object numobj+1000,x*20,object size y(numobj)+5,y*20 : color object numobj+1000,rgb(rnd(255),rnd(255),rnd(255)) : endif : next y : next x : a=numobj+1 : make object box a,19,hite+15,19 : position object a,200,(hite+15)/2,200 : texture object a,2 : a=numobj+1111 : make object sphere a,10 : position object a,200,(hite+20),200 : texture object a,5
create bitmap 1,4,4 : ink rgb(0,0,0),0 : box 0,0,3,3 : get image 4,0,0,3,3 : delete bitmap 1 : for t=10 to 9+nme : make object cube t,6 : rotate object t,0,45,0 : fix object pivot t : texture object t,4 : next t : for t=2 to 9 : make object sphere t,5 : texture object t,5 : scale object t,(10-t)*11,(10-t)*11,(10-t)*11 : set object collision off t : position object t,-999.9,-999.9,-999.9 : x(t)=-999.9 : y(t)=-999.9 : z(t)=-999.9 : next t
start_this_level: : ink rgb(255,0,100),0 : repeat : position object 1,rnd(300)+100,0,rnd(300)+100 : until object collision (1,0)=0 : j=20 : bonus=0 : for t=10 to 9+nme : q=t : repeat : gosub place_enemy : until object collision (q,0)=0 : next t : do : for t=1100 to 1111+numobj : if object exist (t) : set object collision off t : endif : next t
move=0 : if ouch<30 : if upkey() : move=1 : endif : if downkey() : move=-1 : endif : if rightkey() : yrotate object 1,object angle y(1)+4.5 : endif : if leftkey() : yrotate object 1,object angle y(1)-4.5 : endif : endif
c=0 : y=object position y(1) : move object down 1,1 : x=object collision(1,0) : if x>99 : move object up 1,1 : endif : if object position y(1)<1 : move object up 1,1 : endif : yy=object position y(1) : if abs(yy-y)>10 : position object 1,object position x(1),y,object position z(1) : endif : move object 1,move*1.5 : x=object collision(1,0) : if x>99 : move object 1,-move*1.5 : endif
falling=0 :if object position y(1)>3 : move object down 1,1 : if object collision (1,0)=0 : falling=1 : endif : move object up 1,1 : endif : dec j : if j<0 : if j<-20 : if falling=0 : if shiftkey() : j=20 : endif : endif : endif : else : move object up 1,2 : endif
for t=1100 to 1111+numobj : if object exist (t) : set object collision on t : endif : next t : x=object collision (1,0) : if x>999 : score=score+object position y(x) + bonus : inc bonus : if x=1111+numobj : if life<3 : inc life : else bonus=bonus+20 : endif : endif : delete object x : endif : if x>5 and x<99 : ouch=99 : endif
if falling=1 and j<-20 : dec score : inc ouch : endif : if ouch>30 : if falling=0 : dec life : ouch=0 : for t=100 to 5 step -3 : scale object 1,(110-t)*6,t,(110-t)*6 : sync : next t : wait 1000 : scale object 1,100,100,100 : if life>0 : goto start_this_level : else : gosub end_game : goto start_game : endif : endif : endif : if falling=0 : ouch=0 : endif
for t=10 to 9+nme : up=0 : move object t,1 : forward=1 : if object collision (t,0)>70 : move object t,-1 : forward=0 : up=1 : endif : if up=0 : if object position y(t)>3 : move object down t,1 : if object collision(t,0)<70 : up=-1 : endif : move object up t,1 : endif : endif
if up=-1 and forward=1 : move object t,-1 : endif : move object up t,up : x=object position x(t) : z=object position z(t) : if x<0 or x>400 or z<0 or z>400 : point object t,200,object position y(t),200 : yrotate object t,object angle y(t)+rnd(120)-60 : endif : next t
for t=8 to 2 step -1 : x(t+1)=x(t) : y(t+1)=y(t) : z(t+1)=z(t) : next t : x(2)=object position x(1) : y(2)=object position y(1) : z(2)=object position z(1) : for t=2 to 9 : position object t,x(t),y(t),z(t) : next t
TEXT 0,10,"level: "+STR$(level) : TEXT 0,30,"score: "+STR$(score) : TEXT 0,50,"bonus: "+STR$(bonus) : TEXT 0,70,"lives: "+STR$(life) : set camera to follow 0,object position x(1),object position y(1),object position z(1),object angle y(1),25,10,5,0 : position object 999,object position x(1),object position y(1),object position z(1) : position light 1,object position x(1),object position y(1),object position z(1) : if j<-20 and ouch=0 and falling=0 : if val(inkey$())>0 : hite=hite+10 : goto start_new_level : endif : endif : sync : loop
place_enemy: : a=rnd(3) : restore : for b=0 to a : read x,z : next b : if x=-1 : x=rnd(400) :endif: if z=-1 : z=rnd(400) :endif: position object q,x,3,z : point object q,0,3,0 : yrotate object q,object angle y(t)+rnd(120)-60 : return
end_game: : center text 400,10,"HIGHER GROUND" : center text 400,40,"AstrumGames.com" : center text 400,100,"Your Final Score" : center text 400,130,str$(score) : center text 400,200,"press any key to play again" : center text 400,230,"or [ESC] to quit." : SYNC : wait key : return : data 0,-1,400,-1,-1,0,-1,400
bob