here's my new entry to the 20 line challenge,
inspired by my work on 'the coding challenges' thread.
CIRCULAR BREAKOUT
in DBPro
please see 8th post code snippet for no-bug improved version
` GAMEPLAY:
` destroy the boxes swarming around you.
` keep the bouncing ball from hitting your 'inner sphere' by
` moving your 'shield' cube to knock it away.
` CONTROLS:
` left / right arrow keys to rotate your shield
` spacebar to fire the ball when you're holding it
` FEATURES:
` progressively harder levels
` timer-based movement
` psychedelic 3D graphics
` program creates its own media
` adheres to the rules of the 20 line challenge
` 20 line circular breakout
` by bob sauders
` inspired by my entry to the "coding challenges" thread
` 4/17/05
` GAMEPLAY:
` destroy the boxes swarming around you.
` keep the bouncing ball from hitting your 'inner sphere' by
` moving your 'shield' cube to knock it away.
` CONTROLS:
` left / right arrow keys to rotate your shield
` spacebar to fire the ball when you're holding it
` FEATURES:
` progressively harder levels
` timer-based movement
` psychedelic 3D graphics
` program creates its own media
` adheres to the rules of the 20 line challenge
set display mode 800,600,32 : sync on : sync rate 0 : randomize timer() : backdrop on : color backdrop 0 : autocam off : SET TEXT FONT "arial" : set text size 30 : set text to bold : hide mouse : life=2 : level=0
for z=1 to 20 : create bitmap 1,32,32 : ink rgb(rnd(200),rnd(200),rnd(200)),0 : box 0,0,31,31 : for t=1 to 15 : ink rgb(rnd(200),rnd(200),rnd(200)),0 : x=rnd(29-t) : y=rnd(29-t) : box x,y,x+2+t,y+2+t : next t : get image z,0,0,31,31 : delete bitmap 1 : next z
make object box 1,13,13,13 : make object box 2,0,0,0 : hide object 2 : make object sphere 3,32 : position object 3,0,0,0 : make object sphere 4,9 : x=rnd(250) : y=rnd(50) : z=rnd(250) : for t=1 to 4 : color object t,rgb(x,y,z) : next t : ink rgb(x,y,z),0
for t=201 to 220 : make object box t,5,5,5 : position object t,0,0,-300 : point object t,0,0,-400 : set object collision off t : next t : global spd# : ` ink rgb(170,0,95),0
beginanewlevelhere: : life=life+(level/2)+1 : inc level : spd#=(level+9)*1.0 : numbox=6+3*level : boxsize=abs(40-level*2)+5 : boxdist=125-(level*5) : boxmove#=0.0990+level*0.0250 : oscilate=((level-1)*5) : offset#=0.0 : ballheld=1 : boxleft=numbox : degree#=0.0 : if level mod 2=0 then boxmove#=-boxmove#
x=0 : y=(360/numbox) : for t=101 to 100+numbox : make object box t,boxsize,boxsize,boxsize : texture object t,level : d=boxdist : position object t,sin(x)*d,cos(x)*d,0 : x=x+y : next t
make object cube 100,1000 : set object light 100,0 : set object cull 100,0 : texture object 100,level : set object collision off 100 : position object 100,0,0,-250 : position camera 0,0,-250 : T1#=TIMER() : DO : GS#=(TIMER()-T1#)*0.010 : T1#=TIMER() : x=0 : y=(360/numbox) : d=(boxdist+(sin(degree#)*oscilate)) : if d<50 then d=50
offset#=offset#+(rightkey()-leftkey())*(29+level)*gs# : position object 1,sin(offset#)*20,cos(offset#)*20,0 : position object 2,sin(offset#)*230,cos(offset#)*230,0 : point object 1,object position x(2),object position y(2),object position z(2) : degree#=degree#+gs#*4 : if degree#>360.0 then degree#=degree#-360.0
for t=101 to 100+numbox : boxpos#=boxpos#+(boxmove#*gs#) : position object t,sin(boxpos#+x)*d,cos(boxpos#+x)*d,0 : x=x+y : next t : if boxpos#>360.0 then boxpos#=boxpos#-360.0
if ballheld=1 then position object 4,object position x(1),object position y(1),object position z(1) : point object 4,object position x(2),object position y(2),object position z(2) : move object 4,11 : if spacekey() then ballheld=0
if ballheld=0 : move object 4,spd#*gs# : x=object collision(4,0) : if x>100 and x<200 : explode(x,level) : hide object x : set object collision off x : redirball() : dec boxleft : score=score+10*level : endif
if x=1 then rotate object 4,object angle x(1),object angle y(1),object angle z(1)
if x=3 : dec life : ballheld=1 : explode(3,21) : if life < 1 : center text 400,140,"GAME OVER" : CENTER TEXT 400,170,"SCORE: "+STR$(SCORE) : SYNC : wait 5000 : end : endif : endif : endif
if (object position x(1)-object position x(4))^2+(object position y(1)-object position y(4))^2>23000 then redirball()
if boxleft<1 : for x=1 to 30 : for t=201 to 220 : move object t,15*gs# : next t : sync : next x : for t=100 to 100+numbox : delete object t : next t : for t=201 to 220 : position object t,0,0,-300 : point object t,0,0,-400 : next t : goto beginanewlevelhere : endif
rotate object 100,object angle x(100)+gs#,object angle y(100)+gs#,object angle z(100)+gs# : rotate object 3,rnd(360),rnd(360),rnd(360) : for t=201 to 220 : move object t,15*gs# : next t : text 20,20,"Score: "+str$(score): text 700,20,"Life: "+str$(life) : sync : loop
function explode(a,b) : x=object position x(a) : y=object position y(a) : for t=201 to 220 : position object t,x,y,0 : rotate object t,rnd(360),rnd(360),rnd(360) : texture object t,b : next t
endfunction
function redirball() : spd#=spd#+0.1250 : point object 4,rnd(60)-30,rnd(60)-30,0 : if spd#>33.3 then spd#=33.3
endfunction
remstart
1) A line is defined as a line of text, terminated with a carriage return.
2) You can stack multiple commands per line up to a maximum of 25 commands per line.
3) External media is allowed but must be supplied for download or your post will be deleted.
4) External media cannot be larger than 200k in size UNCOMPRESSED.
5) State in the subject or body of the post if it's a DB or DBPro program (or both)
6) Lines with comments (remarks) on are not included in the 20 line maximum and are encouraged to help others understand your code
7) You are free to use blank lines to space out your code for readability, they are not included in the 20 line maximum. The second a line has a command on it it's included.
remend
please see 8th post code snippet for no-bug improved version
http://astrumgames.com
completed games: Astrum Erus, Centipoid, Hero Of Garaven, WarpFlight, Higher Ground , Circular Breakout