Well, following the reopening of the 20 line challenge, I decided to add motion blur and an improved control scheme to a 20 line game I made when the competition wasn't running. This is the game that inspired me to make my TGC Compo entry Ring Worm. The aim is simple, survive as long as you can in the small rectangle whilst red rings bounce around the large rectangle for as long as possible. Easy? No! Fun? Yes!
Its DBPro only, sorry to you classic users, and doesn't need any media. Heres the code:
Type OrbAttr
xpos : ypos : xvel : yvel : radius
Endtype
Dim Orb(10) AS OrbAttr : Dim Player(1) AS OrbAttr : Dim Score(2) : hide mouse : sync on : sync rate 20
for n = 1 to 200 : ink rgb(200,200,0), rgb(0,0,0) : center text 320,120,"OOO OOO O O OO OOO OO OO OOO" : center text 320,120 + 1 * n/20, "O O O OO O O O O O O O O O O " : center text 320,120 + 2 * n/20, "O O O O O O O O O O O O O " : center text 320,120 + 3 * n/20, "OOO O O O O O OOO OOO OOOO O OOO OOO" : center text 320,120 + 4 * n/20, "O O O O O O O O O O O O O O O " : center text 320,120 + 5 * n/20, "O O O O OO O O O O O O O O O " : center text 320,120 + 6 * n/20, "O O OOO O O OO O O O O OO OOO" : sync : cls : next n
repeat : ink rgb(255,255,0),rgb(0,0,0) : set cursor 0,150 : center text 320,120, "WELCOME TO RING RAGE" : center text 320,130, "AVOID THE RED RINGS FOR AS LONG AS YOU CAN" : center text 320,140, "GUIDE YOUR GREEN RING WITH THE ARROW KEYS" : center text 320,150, "PRESS SHIFT TO SPEED UP" : center text 320,160, "OR USE THE MOUSE TO MOVE" : center text 320, 170, "PRESS SPACE TO BEGIN" : sync : cls : until spacekey() = 1
Start:
Score(1) = 0 : Player(1).xpos = 600 : Player(1).ypos = 400 : Player(1).radius = 0 : for n = 1 to 10 : Orb(n).radius = 0 : Orb(n).xpos = 0 : Orb(n).ypos = 0 : Orb(n).xvel = n : Orb(n).yvel = 11 - n : next n
do : xmove = (rightkey() - leftkey()) * 6 * (shiftkey() + 1) + mousemovex() : ymove = (downkey() - upkey()) * 6 * (shiftkey() + 1) + mousemovey() : move = sqrt((xmove * xmove) + (ymove * ymove)) : if move > 25 : ratio = 25000 / move : xmove = (xmove * ratio) / 1000 : ymove = (ymove * ratio) / 1000 : endif : Player(1).xpos = Player(1).xpos + xmove : Player(1).ypos = Player(1).ypos + ymove
Player(1).radius = Player(1).radius + rnd(2) - 1 : if Player(1).radius < 5 : Player(1).radius = 5 : endif : if Player(1).radius > 25 : Player(1).radius = 25 : endif : if Player(1).xpos < 175 : Player(1).xpos = 175 : endif : if Player(1).xpos > 525 : Player(1).xpos = 525 : endif : if Player(1).ypos < 175 : Player(1).ypos = 175 : endif : if Player(1).ypos > 325 : Player(1).ypos = 325 : endif
for n = 1 to 10 : Orb(n).xpos = Orb(n).xpos + Orb(n).xvel : Orb(n).ypos = Orb(n).ypos + Orb(n).yvel : Orb(n).radius = Orb(n).radius + rnd(2) - 1 : if Orb(n).radius < 5 : Orb(n).radius = 5 : endif : if Orb(n).radius > 25 : Orb(n).radius = 25 : endif
if Orb(n).xpos < 100 : Orb(n).xvel = Orb(n).xvel * -1 : Orb(n).xpos = 100 : endif : if Orb(n).xpos > 600 : Orb(n).xvel = Orb(n).xvel * -1 : Orb(n).xpos = 600 : endif : if Orb(n).ypos < 100 : Orb(n).yvel = Orb(n).yvel * -1 : Orb(n).ypos = 100 : endif : if Orb(n).ypos > 400 : Orb(n).yvel = Orb(n).yvel * -1 : Orb(n).ypos = 400 : endif
if (sqrt(((Orb(n).xpos - Player(1).xpos) * (Orb(n).xpos - Player(1).xpos)) + ((Orb(n).ypos - Player(1).ypos) * (Orb(n).ypos - Player(1).ypos))) < (Orb(n).radius + Player(1).radius)) : if Score(1) > Score(2) : Score(2) = Score(1) : endif : repeat : ink rgb(255,255,0),rgb(0,0,0) : set cursor 0,150
center text 320,120, "YOU GOT CAUGHT" : if Score(1) = Score(2) : center text 320,130, "WELL DONE YOU GOT " + str$(Score(1)) : else : center text 320,130, "YOUR SCORE WAS ONLY " + str$(Score(1)) : endif : center text 320,140, "YOUR HIGH SCORE IS " + str$(Score(2))
center text 320,150, "PRESS SPACE TO PLAY AGAIN OR PRESS RETURN TO EXIT" : if returnkey() = 1 : end : endif : sync : cls : until spacekey() = 1 : Goto Start : endif : next n
for b = 0 to 3 : ink rgb(0,255 / (4-b),0),rgb(0,0,0) : circle Player(1).xpos - ((Player(1).xvel * (3-b)) / 2),Player(1).ypos - ((Player(1).yvel * (3-b)) / 2),Player(1).radius - 3 + b : next b : for n = 1 to 10 : for b = 0 to 3 : ink rgb(255 / (4-b),0,0),rgb(0,0,0) : circle Orb(n).xpos - ((Orb(n).xvel * (3-b)) / 2),Orb(n).ypos - ((Orb(n).yvel * (3-b)) / 2),Orb(n).radius - 3 + b : next b : next n : ink rgb(0,0,255),rgb(0,0,0) : line 100,100,100,400 : line 100,400,600,400 : line 600,400,600,100 : line 600,100,100,100
line 175,175,175,325 : line 175,325,525,325 : line 525,325,525,175 : line 525,175,175,175 : Score(1) = Score(1) + 1 : ink rgb(255,255,0),rgb(0,0,0) : text 105,105, "SCORE: " + str$(Score(1)) : text 105,120, "HIGH SCORE: " + str$(Score(2)) : sync : cls : loop
Have fun!
Simple... yet fun!