ultimate breakout by kmm12330th Aug 2003 10:46
|
---|
Summary this is going to eventually have powerups and different kinds of bricks (ei. regular, invisible, metal, ...). there is still a few bugs I'm working on like the ball doesn't bounce Description Code ` This code was downloaded from The Game Creators ` It is reproduced here with full permission ` http://www.thegamecreators.com sync on autocam off data 1,2,2, 0,0,0, 0,0,0, 0,0,0, 0,0,0, 0,0,0, 0,0,0, 0,0,0, 0,0,0, 0,0,0, 0,0,0, 1,2,1, 1,1,0, 0,0,0, 0,0,0, 0,0,0, 0,0,0, 0,0,0, 0,0,0, 0,0,0, rem 1=top wall `2=left wall `3=right wall `4=paddle `5=ball make matrix 1,47,35,47,35 position matrix 1,0,0.5,-33 rem make top wall make object box 1,47,1,1 position object 1,23,1,1 set object collision to boxes 1 rem make left wall make object box 2,1,1,35 position object 2,0,1,-16 set object collision to boxes 2 rem make right wall make object box 3,1,1,35 position object 3,46,1,-16 set object collision to boxes 3 rem make paddle make object box 4,5,1,1 rem make ball make object sphere 5,1 set object collision to spheres 5 position camera 23,30,-16 point camera 23,1,-16 restart: spd#=0.2 times#=1.5 Zmos#=0.05*times# Xmos#=0.05*times# Lives#=2 score#=0 ON#=100 nBposX=0 nBposZ=0 oBposX=0 oBposZ=0 Xcol#=0 Zcol#=0 for x=1 to 22 for z=-1 to -10 step -1 if object exist(ON#)=0 make object box ON#,1.9,1,0.9 position object ON#,X*2,1,Z set object collision to spheres ON# endif inc ON# next z next x start: position object 4,23,1,-32 position object 5,23,1,-31 repeat if leftkey() move object left 4,spd# move object left 5,spd# endif if rightkey() move object right 4,spd# move object right 5,spd# endif ink rgb(255,255,255),0 set text size 10 text 10,10,"Lives: "+str$(lives#) text 100,10,"Score: "+str$(score#) text 550,10,"FPS: "+str$(FPS#) sync until spacekey() `*************` `**MAIN LOOP**` `*************` do Xcol#=0 Zcol#=0 PL#=1 FPS#=screen fps() rem set up keys for paddle if leftkey() and object position x(4) > 3 move object left 4,spd# endif if rightkey() and object position x(4) < 43 move object right 4,spd# endif if object collision(5,0) rem check if ball hit the top wall if object collision(5,1) rem if it did reverse the Z motion Zmos#=-Zmos# endif rem check if ball hit a side wall if object collision(5,2) or Object collision(5,3) rem if it did reverse the X motion Xmos#=-Xmos# endif for x=100 to 320 if object exist(x) if object collision(5,x) if Xcol#=0 position object 5,oBposX#,1,nBposZ# if object collision(5,x)=0 Xcol#=1 endif endif if Zcol#=0 position object 5,nBposX#,1,oBposZ# if object collision(5,x)=0 Zcol#=1 endif endif position object 5,nBposX#,1,nBposZ# score#=score#+10 delete object x endif endif next x if Xcol#=1 Xmos#=-Xmos# endif if Zcol#=1 Zmos#=-Zmos# endif endif if object position z(5) < -31 and object position z(5) > -32 if object position X(5) >= object position x(4)-2*PL# and object position X(5) < object position x(4)-1.9*PL# Xmos#=-0.08*times# Zmos#=0.02*times# endif if object position X(5) >= object position x(4)-1.9*PL# and object position X(5) < object position x(4)-1.6*PL# Xmos#=-0.07*times# Zmos#=0.03*times# endif if object position X(5) >= object position x(4)-1.6*PL# and object position X(5) < object position x(4)-0.7*PL# Xmos#=-0.05*times# Zmos#=0.05*times# endif if object position X(5) >= object position x(4)-0.7*PL# and object position X(5) < object position x(4)-0.2*PL# Xmos#=-0.02*times# Zmos#=0.08*times# endif if object position X(5) >= object position x(4)-0.2*PL# and object position X(5) < object position x(4)*PL# Xmos#=-0.001*times# Zmos#=0.099*times# endif if object position X(5) >= object position x(4)*PL# and object position X(5) < object position x(4)+0.2*PL# Xmos#=0.001*times# Zmos#=0.099*times# endif if object position X(5) >= object position x(4)+0.2*PL# and object position X(5) < object position x(4)+0.7*PL# Xmos#=0.02*times# Zmos#=0.08*times# endif if object position X(5) >= object position x(4)+0.7*PL# and object position X(5) < object position x(4)+1.6*PL# Xmos#=0.05*times# Zmos#=0.05*times# endif if object position X(5) >= object position x(4)+1.6*PL# and object position X(5) < object position x(4)+1.9*PL# Xmos#=0.07*times# Zmos#=0.03*times# endif if object position X(5) >= object position x(4)+1.9*PL# and object position X(5) < object position x(4)+2*PL# Xmos#=0.08*times# Zmos#=0.02*times# endif endif if object position z(5)<-34 if lives#>0 lives#=lives#-1 goto start else ink rgb(255,0,0),0 set text font "arial" set text size 30 set text opaque center text 320,240,"G A M E O V E R" wait key goto restart endif endif ink rgb(255,255,255),0 set text size 10 text 10,10,"Lives: "+str$(lives#) text 100,10,"Score: "+str$(score#) text 550,10,"FPS: "+str$(FPS#) oBposX# = object position X(5) oBposZ# = object position Z(5) nBposX# = object position X(5)+Xmos#*2 nBposZ# = object position Z(5)+Zmos#*2 nBposY# = Get Ground Height(1,nBposX#,nBposZ#) position object 5,nBposX#,nBposY#+1,nBposZ# sync loop |