Out at the Air National Guard this weekend I was challenged to write a game in 20 lines for everyone to have a competition on.
Controls:
Cursor keys move in respective directions
Z -- moves toward the screen
Y -- moves away from the screen
Rules:
You're the cube. Hit the sphere. The sphere positions randomly each time you hit it.
randomize 100 : sync on : ink RGB(255,0,0),0 : make camera 1 : position camera 1, 0, 250, 0 : point camera 1, 10, 0, 0 : make object cube 1, 10 : position object 1, 10, -50, 0 : make object sphere 2, 5 : position object 2, 100, 50, 50
endtimer=90 : wait key : newtime = timer()/1000
do
if rightkey() = 1 then position object 1, object position x(1), object position y(1), object position z(1) - .5
if leftkey() = 1 then position object 1, object position x(1), object position y(1), object position z(1) + .5
if upkey() = 1 then position object 1, object position x(1) + .5, object position y(1), object position z(1)
if downkey() = 1 then position object 1, object position x(1) - .5, object position y(1), object position z(1)
if inkey$() = "z" or inkey$() = "Z" then position object 1, object position x(1), object position y(1) + .5, object position z(1)
if inkey$() = "x" or inkey$() = "X" then position object 1, object position x(1), object position y(1) - .5, object position z(1)
if object collision (1,2) = 1 : points = points + 1 : position object 2, rnd(100), rnd(100), rnd(100) : endif
set cursor 10, 20 : print "Time remaining: "; endtimer; " seconds" : set cursor screen width()/2, 20 :print points
if (timer()/1000) = (newtime + 1)
endtimer=endtimer-1 : if endtimer = 0 then goto endgame
newtime = timer()/1000 : endif
sync : loop
endgame:
cls : set cursor 10, 20 : print "Time remaining: "; endtimer; " seconds" : set cursor screen width()/2, screen height()/2
print "End of the game" : set cursor screen width()/2, screen height()/2 + 10 : print "You had a score of "; points; " points."
sync : wait 2000 : wait key : end
return
If at first you dont succeed, LOWER YOUR STANDARDS.