Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
X-Racer
#6
Cool! 

Implemented a couple of your changes and a couple of mine (something isn't working right, I blame myself)

Code: (Select All)
'X-racer is an old school racing game using text graphics only
'press spacebar to get that engine going and < or > to steer  b to brake!
_Title "X-RACER"
track$ = "####OOO................OOO####"
n = 13
trend = 0
obstacle = 10
Randomize Timer
Dim b$(2010)
Dim nn(0 To 2010)
start:
ask$ = "."
spd = 1
tracksize = 310
srun = 8
Do
    Cls
    For x = 1 To tracksize
        A$ = String$(n, 32)
        b$(x) = A$ + track$
        If x > 100 And x Mod obstacle Then
            If Rnd * 100 < obstacle Then Mid$(b$(x), n + Int(3 + Rnd * 18), 1) = "O"
        End If

        n = n + Int(Rnd * 2) - Int(Rnd * 2) + trend
        If n < 2 Then n = 2
        If n > 35 Then n = 35
        nn(x) = n
        If nn(x - 1) = nn(x) Then srun = srun - 1 Else srun = 8
        If srun = 0 Then
            If n < 25 Then
                trend = 1
            Else
                trend = -1
            End If
        End If

        If Rnd * 100 < 3 Then
            Select Case Int(Rnd * 3)
                Case 0
                    trend = 0
                Case 1
                    trend = -1

                Case 2
                    trend = 1
            End Select
        End If
    Next x
    A$ = String$(n, 32)
    b$(tracksize - 20) = A$ + "####O============O####"
    b$(tracksize - 19) = A$ + "####O============O####"
    b$(tracksize - 18) = A$ + "####O            O####"
    b$(tracksize - 17) = A$ + "####O   FINISH   O####"
    b$(tracksize - 16) = A$ + "####O            O####"
    b$(tracksize - 15) = A$ + "####O============O####"
    For x = tracksize - 14 To tracksize
        A$ = String$(n, 32)
        b$(x) = A$ + "####O            O####"
    Next x
    dp = nn(10) + 15
    op = dp
    For x = 1 To tracksize
        _Limit 20
        _PrintString (op, 9), "."
        Print b$(x);
        If x > 12 Then
            If Mid$(b$(x - 13), dp, 1) = "O" Then GoTo crash
        End If
        op = dp
        If x Mod 20 = 0 Then
            Print " - "; x * 5
        Else
            Print
        End If
        If x > 10 Then
            gg = 0
            Do
                _Limit 60
                gg = gg + 1
                kk$ = InKey$
            Loop Until kk$ <> "" Or gg = 30 - spd
        End If
        If x = 12 Then t1 = Timer
        Select Case kk$
            Case ".", ">"
                op = dp
                dp = dp + 1

            Case ",", "<"
                op = dp
                dp = dp - 1.
            Case " "
                spd = spd + 1
                If spd > 28 Then spd = 28
            Case "b"
                spd = spd - 2
                If spd < 1 Then spd = 1
        End Select
        mph$ = "MPH : " + Str$(spd * 10)
        _PrintString (1, 1), mph$
        If x > 10 Then Color 12: _PrintString (dp, 10), "X": Color 15
        _Display
    Next x
    t2 = Timer
    Print
    Print "Finished Course !"
    Print
    Print "Finish Time "; t2 - t1
    Input "Play again (Y or N) ", ask$
    ask$ = UCase$(ask$)
    If ask$ = "N" Then GoTo alldone
Loop
End
crash:
For c = 1 To 6
    _Limit 8
    Color 12
    For cx = dp - c To dp + c
        For cy = 10 - c To c + 10
            If Rnd * 6 < 3 Then _PrintString (cx, cy), "@"
        Next cy
    Next cx
Next c
Color 15
Print "YOU CRASHED"
Input "Play again (Y or N) ", ask$
ask$ = UCase$(ask$)
If ask$ = "N" Then GoTo alldone
GoTo start
alldone:
End
Reply


Messages In This Thread
X-Racer - by James D Jarvis - 12-22-2022, 06:28 PM
RE: X-Racer - by Pete - 12-22-2022, 07:15 PM
RE: X-Racer - by James D Jarvis - 12-22-2022, 07:44 PM
RE: X-Racer - by Pete - 12-22-2022, 07:47 PM
RE: X-Racer - by mnrvovrfc - 12-23-2022, 12:15 PM
RE: X-Racer - by James D Jarvis - 12-23-2022, 09:44 PM
RE: X-Racer - by mnrvovrfc - 12-23-2022, 11:08 PM
RE: X-Racer - by James D Jarvis - 12-24-2022, 05:55 PM



Users browsing this thread: 2 Guest(s)