hey everyone! THis is my first 20 line ever written in Dbp. Its just a small game I made where you have to dodge the balls that come at you. For each one you dodge you get a point. Here it is:
UPDATED CODE:
sync on:sync rate 50:hide mouse:autocam off:randomize timer():make object sphere 101,2:playerzpos#=-10
for x = 1 to 20:make object sphere x,1.5:color object x,rgb(rnd(255),rnd(255),rnd(255)):position object x,0,0,10:next x
score#=0:speed#=-0.5:gameover#=0:make object box 102,3,3,50:color object 102,rgb(20,20,20):make object box 103,3,3,50:color object 102,rgb(20,20,20):position object 102,22.5,0,0:position object 103,-22.5,0,0
position camera 0,40,0:point camera 0,0,0:red#=0:green#=0:blue#=0
do:if leftkey()=1:playerpos#=playerpos#-1:endif:if rightkey()=1:playerpos#=playerpos#+1:endif:if playerpos#>20:playerpos#=playerpos#-1:endif:if playerpos#<-20:playerpos#=playerpos#+1:endif
if upkey()=1:playerzpos#=playerzpos#+1:endif:if downkey()=1:playerzpos#=playerzpos#-1:endif:if playerzpos#>0:playerzpos#=playerzpos#-1:endif:if playerzpos#<-20:playerzpos#=playerzpos#+1:endif:position object 101,playerpos#,0,playerzpos#
inc red#,3:inc blue#,2:inc green#,1:color backdrop rgb(red#,green#,blue#):text 0,0,str$(score#):if theend = 1:text 200,200,"Gameover your score was: "+str$(score#):gameover#=gameover#+1:if gameover# = 100:end:endif:endif
if theend = 0:for x = 1 to 20:if object position z(x)<=-20:position object x,-20+rnd(40),0,10+rnd(15):score#=score#+1:endif:move object x,speed#
if object collision(x,101):hide object 101:text 100,100,"Gameover!":theend = 1:endif:next x:endif:sync:loop
try it out if you want too. i've gotten over a thousand but you should be able to do better.
____ ____ ____ ___ _ _ __ _ _ __ _ _ ____
|___ |--< |--| /__ Y | \| | | \| ___| |--|