'I've wanted to make this game since I was a kid when I owned a little hand-held race car game where you steered the little wheel"
'to avoid the other cars. That toy broke when I was a kid so I've wanted a similar one on the computer. :)
'Enjoy!
'
'Version 2 was made on July 16, 2019 by Ken G.
'Freeware only.
'
'Added features on Version 2 are: oil slicks, acceleration and deceleration, speed indicator, passed up cars indicator,
'score change that times it by passed up cars at the end, outside buildings, Top Ten Racers score sheet, and other minor adjustments.
begin:
PRINT " Use your arrow keys to steer your car" PRINT " around the other cars and go as far as you" PRINT " can without hitting them, as well as the round" PRINT " Press the up and down arrow keys to move" PRINT " faster or slower and also to stop turning." PRINT " Every time you hit a street edge, you" PRINT " lose 200 points." PRINT " Every time you hit an oil slick your car" PRINT " moves a random direction." PRINT " Every time you hit another car you lose a car." INPUT " Press Enter to play!", a$
DIM name$
(50), score
(50), nm$
(50), scc
(50) tim = .02
rc = 5
x = 320
y = 250: yy = 450
cx = 350: cy = 420
u = 1
sc = 0
one = 0
collision = 0
collision2 = 0
o = 0
other = 0
sct = 0
go:
u = 1
d = 0
r = 0
L = 0
tim = tim - .004
u = 0
d = 1
r = 0
L = 0
tim = tim + .004
ocx = cx: ocy = cy
cx = cx + 2
'Check street edge.
cx = 550
sc = sc - 200
ocx = cx: ocy = cy
cx = cx - 2
'Check street edge.
cx = 60
sc = sc - 200
'Street Sides
'Other Car
occ = 1
oyyy = 250
oxxx = 305
oldoyyy = oyyy
oldoxxx = oxxx
oyyy = oyyy + 5
oxxx = oxxx + oxx2
LINE (oldoxxx
, oldoyyy
)-(oldoxxx
+ 30, oldoyyy
+ 30), _RGB32(0, 0, 0), BF
LINE (oxxx
, oyyy
)-(oxxx
+ 30, oyyy
+ 30), _RGB32(127, 249, 127), BF
occ = 0
LINE (oxxx
, oyyy
)-(oxxx
+ 20, oyyy
+ 20), _RGB32(0, 0, 0), BF
other = other + 1
oyyy = 250
oxxx = 320
collision = 0
nex:
'Detect Collision
IF cx
> oxxx
- 10 AND cx
< oxxx
+ 40 AND cy
> oyyy
- 5 AND cy
< oyyy
+ 35 THEN IF collision
= 0 THEN rc
= rc
- 1 collision = 1
'Oil Slick
oil2 = 1
oilyyy = 250
oilxxx = 305
oldoilyyy = oilyyy
oldoilxxx = oilxxx
oilyyy = oilyyy + 5
oilxxx = oilxxx + oilx2
o = o + 1
oil:
oilyyy = 250
oilxxx = 330
collision2 = 0
o = 0
oil2 = 0
nex2:
'Detect Collision With Oil Slick
IF cx
> oilxxx
- 5 AND cx
< oilxxx
+ 35 AND cy
> oilyyy
- 5 AND cy
< oilyyy
+ 35 THEN IF skid
> 50 THEN r
= 1: L
= 0 IF skid
<= 50 THEN L
= 1: r
= 0 collision2 = 1
'Buildings
b2 = 1
bx3 = 10
bx3 = -10
byyy = 255
oldbyyy = byyy
oldbxxx = bxxx
byyy = byyy + 5
bxxx = bxxx + bx3
ob = ob + 1
'old erase
LINE (oldbxxx
, oldbyyy
)-(oldbxxx
+ bsz
, oldbyyy
+ bsz2
), _RGB32(0, 0, 0), B
building:
'new
LINE (bxxx
, byyy
)-(bxxx
+ bsz
, byyy
+ bsz2
), _RGB32(127, 227, 127), B
'old erase again
LINE (oldbxxx
, oldbyyy
)-(oldbxxx
+ bsz
, oldbyyy
+ bsz2
), _RGB32(0, 0, 0), B
byyy = 250
'bxxx = 330
ob = 0
b2 = 0
nex3:
bb2 = 1
bbx3 = 10
bbx3 = -10
bbyyy = 255
oldbbyyy = bbyyy
oldbbxxx = bbxxx
bbyyy = bbyyy + 5
bbxxx = bbxxx + bbx3
obb = obb + 1
'old erase
LINE (oldbbxxx
, oldbbyyy
)-(oldbbxxx
+ bbsz
, oldbbyyy
+ bbsz2
), _RGB32(0, 0, 0), B
building2:
'new
LINE (bbxxx
, bbyyy
)-(bbxxx
+ bbsz
, bbyyy
+ bbsz2
), _RGB32(127, 227, 127), B
'old erase again
LINE (oldbbxxx
, oldbbyyy
)-(oldbbxxx
+ bbsz
, oldbbyyy
+ bbsz2
), _RGB32(0, 0, 0), B
bbyyy = 250
'bbxxx = 330
obb = 0
bb2 = 0
nex4:
sc = sc + 1
linesmoving:
oy = y
y = y + 5
oyy = yy
yy = yy + 5
drawcar:
'Car
LINE (cx
, cy
)-(cx
+ 30, cy
+ 30), _RGB32(127, 227, 127), BF
LINE (cx
+ 5, cy
- 5)-(cx
+ 25, cy
), _RGB32(127, 227, 127), BF
erasecar:
LINE (ocx
, ocy
)-(ocx
+ 30, ocy
+ 30), _RGB32(0, 0, 0), BF
LINE (ocx
+ 5, ocy
- 5)-(ocx
+ 25, ocy
), _RGB32(0, 0, 0), BF
done:
scc = sc * other
LOCATE 14, 1:
PRINT sc;
" x "; other;
" Passed Up Cars = Total Score: "; scc
LOCATE 20, 1:
INPUT "Press Enter to see Top Ten list.", topten$
'Top Ten Racers
nn = n
PRINT "You have made the Top Ten!" typename:
INPUT "Type your name here (25 letters and spaces maximum.):", nm$
(nn
) PRINT "Name too long, try again." sccc(nn) = scc
sct = 1
nex5:
nex6:
nex7:
PRINT " T O P T E N R A C E R S" nex8:
nm$(n) = ""
score(n) = 0
sccc(n) = 0
INPUT "Would you like to play again? (Yes/No)", ag$
IF ag$
= "y" OR ag$
= "Y" OR ag$
= "YES" OR ag$
= "yes" OR ag$
= "Yes" OR ag$
= "yES" OR ag$
= "yeS" THEN GOTO begin: