 |
| Author |
Message |
IBOL
User
Joined: Tue Mar 30th 2004
Location: chair
|
|
Posted: 18th Apr 2005 07:55 Edited: 17th May 2005 21:07 |
| link | toggle |
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
+ Code Snippet
` 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
|
Back to top
 |
|
IBOL
User
Joined: Tue Mar 30th 2004
Location: chair
|
i actually managed to pare this down to 18 lines,
and make it even better!
+ Code Snippet
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=0 : level=0
make object box 1,13,16,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 : for t=1 to 4 : color object t,rgb(0,0,0) : fade object t,20 : next t
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#
beginanewlevelhere: : life=life+3 : 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#
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 1,0,0,31,31 : delete bitmap 1 : ink 0,0
x=0 : y=(360/numbox) : for t=101 to 100+numbox : make object box t,boxsize,boxsize,boxsize : texture object t,1 : 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,1 : 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())*30.0*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 : a=x : gosub explode : hide object x : set object collision off x : gosub 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 : spd#=spd#-3.0 : if spd#<((level+9)*1.0) : spd#=((level+9)*1.0) : endif :ballheld=1 : a=3 : gosub explode : if life < 1 : set text size 80 : center text 400,100,"GAME OVER" : CENTER TEXT 400,160,"LEVEL: "+STR$(LEVEL) : CENTER TEXT 400,220,"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 gosub 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,540,"Level: "+str$(level) : text 20,20,"Score: "+str$(score): text 700,20,"Life: "+str$(life) : sync : loop
redirball: : spd#=spd#+0.1250 : point object 4,rnd(60)-30,rnd(60)-30,0 : if spd#>33.3 : spd#=33.3 :endif: return
explode: : xx=object position x(a) : yy=object position y(a) : for t=201 to 220 : position object t,xx,yy,0 : rotate object t,rnd(360),rnd(360),rnd(360) : texture object t,1 : next t : return
bob
|
Back to top
 |
|
mm0zct
User
Joined: Tue Nov 18th 2003
Location: scotland-uk
|
|
Posted: 14th May 2005 00:58 Edited: 14th May 2005 01:00 |
| link | toggle |
object alerady exist at ilne 6 error after several minutes of playing, several hundred levels in, several million points, i forgot to get a screenshot of my score too lol, great adictive game but very easy once you've developed a stratedy, a good 20 liner though. i had about 15 lives left too. if you get them all really close to you and release and stay still you can take them all out in one rotation of the cubes.
http://www.larinar.tk
AMD athlon 64 3000+, 512mb ddr400, abit kv8, 160gb hdd, gigabit lan, ati radeon 9800se 128mb.
|
Back to top
 |
|
EddieB
User
Joined: Wed Sep 29th 2004
Location: United Kingdom
|
That is a great and adictive game
I got 1380!
Learning winAPI with C++ and openGL
|
Back to top
 |
|
The Nerd
User
Joined: Sat Jun 5th 2004
Location: Denmark
|
|
Posted: 16th May 2005 00:41 Edited: 16th May 2005 00:43 |
| link | toggle |
LOL!!!
REALLY FUN GAME!!!!
i was bored and played the game in a while.. Made it up on over 200000 and got over 50 lifes!  The only strange thing was.. Suddenly i got and error that said "Object already exist" :-(
And i was planning to take a screenshot of my highscore
the last levels before the error the color on all the things in the game was white! And the cubes moved soo fast that it was easy to proceed since the ball took em' out quick
|
Back to top
 |
|
mm0zct
User
Joined: Tue Nov 18th 2003
Location: scotland-uk
|
|
Posted: 17th May 2005 00:55 Edited: 17th May 2005 01:08 |
| link | toggle |
eddie that's pretty lame, you giving it the attention it's worth lol.
mine was well over 100000 i'm sure.
edit once you get to over 200000 points it crashes with the error previously stated 
beat that eddieb (good luck since it crashes lol) only took about 5 mins and i had 19 lives left.
http://www.larinar.tk
AMD athlon 64 3000+, 512mb ddr400, abit kv8, 160gb hdd, gigabit lan, ati radeon 9800se 128mb.
|
Back to top
 |
|
IBOL
User
Joined: Tue Mar 30th 2004
Location: chair
|
hey thanks all!
i will fix that bug, since i still have 2 lines to work with
(if you use the second post's code, which you should)
bob
http://astrumgames.com
completed games: Astrum Erus, Centipoid, Hero Of Garaven, WarpFlight, Higher Ground , Circular Breakout
|
Back to top
 |
|
IBOL
User
Joined: Tue Mar 30th 2004
Location: chair
|
|
Posted: 17th May 2005 21:05 Edited: 17th May 2005 21:07 |
| link | toggle |
here is the new version, fixing that 'object exist' bug. (still 20 lines)
now you can play forever! enjoy...
+ Code Snippet
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=0 : level=0
make object box 1,13,16,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 : for t=1 to 4 : color object t,rgb(0,0,0) : fade object t,20 : next t
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#
beginanewlevelhere: : life=life+3 : inc level : spd#=(level+9)*1.0 : numbox=6+3*level
` here is where i put in the 'object exist' fix:
if numbox>90 : numbox=90 : endif
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#
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 1,0,0,31,31 : delete bitmap 1 : ink 0,0
x=0 : y=(360/numbox) : for t=101 to 100+numbox : make object box t,boxsize,boxsize,boxsize : texture object t,1 : 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,1 : 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())*30.0*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 : a=x : gosub explode : hide object x : set object collision off x : gosub 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 : spd#=spd#-3.0 : if spd#<((level+9)*1.0) : spd#=((level+9)*1.0) : endif :ballheld=1 : a=3 : gosub explode : if life < 1 : set text size 80 : center text 400,100,"GAME OVER" : CENTER TEXT 400,160,"LEVEL: "+STR$(LEVEL) : CENTER TEXT 400,220,"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 gosub 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,540,"Level: "+str$(level) : text 20,20,"Score: "+str$(score): text 700,20,"Life: "+str$(life) : sync : loop
redirball: : spd#=spd#+0.1250 : point object 4,rnd(60)-30,rnd(60)-30,0 : if spd#>33.3 : spd#=33.3 :endif: return
explode: : xx=object position x(a) : yy=object position y(a) : for t=201 to 220 : position object t,xx,yy,0 : rotate object t,rnd(360),rnd(360),rnd(360) : texture object t,1 : next t : return
bob
http://astrumgames.com
completed games: Astrum Erus, Centipoid, Hero Of Garaven, WarpFlight, Higher Ground , Circular Breakout
|
Back to top
 |
|
|
Google Ad
AdBot
Joined: Aug 26th 2002
Location: Everywhere
|
|
Back to top
 |
|
Three Score
User
Joined: Fri Jun 18th 2004
Location: behind you
|
so is there anything past level 4 cause i dont know how u could fit any more boxes in that small radius circle
also i love your box background u have to look pretty close to actualy see that it is only boxes in a random patern
nice work
formerly shadows of emptiness
|
Back to top
 |
|
Antidote
User
Joined: Fri Mar 18th 2005
Location: Raleigh, NC, USA
|
|
Posted: 1st Jun 2005 15:44 Edited: 1st Jun 2005 15:44 |
| link | toggle |
I changed the controls to using the mouse which worked a little better for me then got bored when I got over level 100. Nice job highly addictive
I have know idea what sflm stands for
|
Back to top
 |
|
Robot
User
Joined: Thu May 27th 2004
Location: Cyberspace
|
Congratulations for being the the newsletter.
The happenings of tommorow are behind us now
|
Back to top
 |
|
IBOL
User
Joined: Tue Mar 30th 2004
Location: chair
|
yes, i AM the newsletter!
(play on words from post above...will edit out if you change it...)
http://astrumgames.com
completed games: Astrum Erus, Centipoid, Hero Of Garaven, WarpFlight, Higher Ground , Circular Breakout
|
Back to top
 |
|
Robot
User
Joined: Thu May 27th 2004
Location: Cyberspace
|
oops...  . But I'll keep it their anyway because of your reply.
The happenings of tommorow are behind us now
|
Back to top
 |
|
mm0zct
User
Joined: Tue Nov 18th 2003
Location: scotland-uk
|
over about 50 it gets really easy, just release the bal and you've completed the level:
http://www.larinar.tk
AMD athlon 64 3000+, 512mb ddr400, abit kv8, 160gb hdd, gigabit lan, ati radeon 9800se 128mb.
|
Back to top
 |
|
IBOL
User
Joined: Tue Mar 30th 2004
Location: chair
|
yeah, but hey, you played till level 116, right?
that must say something good about the game.
thanks, all!
bob
http://astrumgames.com
completed games: Astrum Erus, Centipoid, Hero Of Garaven, WarpFlight, Higher Ground , Circular Breakout
|
Back to top
 |
|
Captain America
User
Joined: Fri Apr 8th 2005
Location: Here
|
hey i doesnt work for me, and i was wondering if you have some spare time on your hands if you could build the final exe and put it up on this forum, or just email it to me at: relith@cox.net
thanks in advance!
|
Back to top
 |
|
Sven B
User
Joined: Wed Jan 5th 2005
Location: Belgium
|
Damn i forgot wich lvl, but ther's a lvl where the circle of cubes isn't completely filled. It has a hole in it  Anyway, i stopped at 11 130 points...
Immunity and Annihalation makes Immunihalation...
|
Back to top
 |
|
Sorry, but it has been so long since anyone replied to this Thread that it has been automatically locked.
You may read it but not reply.
Enter a word or phrase to search our Forum for:
|
|
 |