set display mode 1024,768,32 color backdrop 0 hide mouse 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, `1=top wall `2=left wall `3=right wall `4=paddle `5=ball ink 0,0:box 0,0,10,10:get image 100,0,0,10,10 make matrix 1,47,35,47,35 position matrix 1,0,0.5,-33 prepare matrix texture 1,100,1,1 `make top wall make object box 1,47,1,1 position object 1,23,1,1 set object collision to boxes 1 color object 1,rgb(0,0,255) ghost object on 1 `make left wall make object box 2,1,1,35 position object 2,0,1,-16 set object collision to boxes 2 color object 2,rgb(0,0,255) ghost object on 2 `make right wall make object box 3,1,1,35 position object 3,46,1,-16 set object collision to boxes 3 color object 3,rgb(0,0,255) ghost object on 3 `make paddle make object box 4,4,.5,.8 color object 4,rgb(0,255,0) ghost object on 4 `make ball make object sphere 5,.8,50,50 color object 5,rgb(255,0,0) ghost object on 5 set object collision to spheres 5 `make bacground make object cube 6,17 scale object 6,100,10,100 position object 6,23,0,-18 color object 6,rgb(255,255,255) ghost object on 6 position camera 23,30,-16 point camera 23,1,-16 `make powerups `faster move restart: rnd1=rnd(640) rnd2=rnd(480) level=1 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 newlevel: nlevel=0 if level=1 levelx=11 levelxx=10 stepx=1 levelz=-5 stepz=-1 endif if level=2 levelx=11 levelxx=10 stepx=2 levelz=-15 stepz=-1 endif if level=3 levelx=1 levelxx=22 stepx=1 levelz=-25 stepz=-1 endif for x=1 to levelx step stepx for z=-1 to levelz step stepz if object exist(ON#)=0 make object box ON#,1.7,.4,0.7 position object ON#,X*2+levelxx,1,Z set object collision to spheres ON# color object ON#,rgb(255,0,255) endif inc ON# next z next x start: position object 4,23,1,-32 position object 5,23,1.5,-31 repeat if mousemovex()=0 and mousex()<512 then xmouse=xmouse+1 if mousemovey()=0 and mousex()>512 then xmouse=xmouse-1 yrotate object 6,xmouse*1 if rnd(300)=1 rnd1=rnd(640) rnd2=rnd(480) position mouse rnd1,rnd2 else position mouse rnd1,rnd2 endif if leftkey() and object position x(4) > 2.5 move object left 4,spd# move object left 5,spd# endif if rightkey() and object position x(4) < 43.5 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() do if mousemovex()=0 and mousex()<512 then xmouse=xmouse+1 if mousemovey()=0 and mousex()>512 then xmouse=xmouse-1 yrotate object 6,xmouse*1 if rnd(300)=1 rnd1=rnd(640) rnd2=rnd(480) position mouse rnd1,rnd2 else position mouse rnd1,rnd2 endif Xcol#=0 Zcol#=0 PL#=1 FPS#=screen fps() rem set up keys for paddle if leftkey() and object position x(4) > 2.5 move object left 4,spd# endif if rightkey() and object position x(4) < 43.5 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 ON# if object exist(x)=1 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 else if nlevel=ON#-100 then inc level:nlevel=0:inc score,100:ON#=100:gosub newlevel inc nlevel endif next x nlevel=0 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