By sparcie

This is another game I got from a long forgotten Basic book in the school library. It’s pretty simple, you are a skier going down a slope and need to keep from hitting the edges of the ski-run. As per Ghost Guzzler I have re-written this game for better timing as it was CPU dependent for speed, and I have added a feature or two. Interestingly this game uses the text scrolling ability to make it look like a much more advanced scrolling graphical game. I’ve seen another game that uses this technique recently called Space Escape that I found quite fun.

Anyway here is the code.

10 REM *************
20 REM Remake of Ski
30 REM *************
40 REM Another game from a long forgotten book.
50 REM It is interesting because it takes advantage of text scrolling
60 REM to move the play area. I've re-written the code for better timing
70 REM mostly as the original relied on CPU speed.
80 RANDOMIZE TIMER
90 DEFINT A-Z
100 KEY OFF
110 COLOR 12,15 : REM change this if you don't like a white background
120 CLS
130 PRINT "<<< Downhill Skiiing >>>"
140 PRINT "Remade by Sparcie"
150 L$=",": R$=".": REM the controls
160 PRINT
170 PRINT "This is a simple game where you are skiing down a slope and"
180 PRINT "need to keep on the ski slope so you don't fall off the mountain."
190 PRINT "It's quite similar to early car racing games."
200 PRINT "press "+L$+" to go left and "+R$+" to go right"
210 PRINT
220 PRINT "Select game speed (1 2 3 4)"
230 C$ = INPUT$(1)
240 IF C$="1" OR C$="2" OR C$="3" OR C$="4" THEN 260
250 GOTO 230
260 LEVEL = VAL(C$)
270 GAP! = .3/LEVEL : REM sets the gap between game ticks
280 NEXTT! = TIMER
290 SCORERATE = 5 * LEVEL
300 SCORE = 0
310 PLAYERX = 40
320 WID = 20
330 TRACK = 30
340 C$ = INKEY$
350 IF C$ = L$ AND PLAYERX>1 THEN PLAYERX=PLAYERX-1
360 IF C$ = R$ AND PLAYERX<79 THEN PLAYERX=PLAYERX+1
370 R = INT(RND*5)
380 IF R = 0 AND TRACK > 1 THEN TRACK=TRACK-1
390 IF R = 1 AND WID>5 THEN WID=WID-1
400 IF R = 3 AND WID<20 THEN WID=WID+1
410 IF R = 4 AND TRACK<79-WID THEN TRACK=TRACK+1
420 PRINT TAB(TRACK); "#"; TAB(PLAYERX); CHR$(19); TAB(TRACK+WID); "#"
430 SCORE = SCORE + SCORERATE
440 REM a blank line!
450 IF TIMER<NEXTT! THEN 440
460 NEXTT! = TIMER+GAP!
470 IF PLAYERX=<TRACK OR PLAYERX>=(TRACK+WID) THEN 490
480 GOTO 340
490 PRINT "Ouch! you hit the wall!"
500 PRINT
510 PRINT "You got a score of: ",SCORE
520 PRINT "Do you wish to play again? (y/n)"
530 C$ = INPUT$(1)
540 IF C$ = "y" THEN 220
550 IF C$ = "n" THEN 570
560 GOTO 530
570 PRINT  "bye!..."

4 Responses to “Down-Hill Skiing for GWBasic”


  1. 1 evertonmarques
    February 13, 2019 at 1:31 pm

    Hi,

    For fun, I am writing a toy compiler for BASIC.
    I enjoy finding simple BASIC games that I can feed into the compiler in order to see how it handles simple code.

    I am hitting some issues understanding the skiing game:

    1. What operator is supposed to relate playerx to 1 on line 360?

    360 IF C$ = R$ AND PLAYERX 1 THEN TRACK=TRACK-1

    2. How is R variable assigned?

    390 IF R = 1 AND WID>5 THEN WID=WID-1
    400 IF R = 3 AND WID<20 THEN WID=WID+1
    410 IF R = 4 AND TRACK<79-WID THEN TRACK=TRACK+1

    3. In line 470, can the double equal sign be replaced by a single equal?

    470 IF PLAYERX==(TRACK+WID) THEN 490

    Btw, you can find my WIP BASIC compiler here:

    https://github.com/udhos/basgo

    Thanks,
    Everton

    • February 13, 2019 at 8:36 pm

      Hi Everton,

      Thanks for taking a look at this old gem. I’ve compared the source file on my machine to this and it appears to be missing this line

      370 R = INT(RND*5)

      Which should answer your second question.

      line 350 and 360 also appears on my disk as
      350 IF C$ = L$ AND PLAYERX>1 THEN PLAYERX=PLAYERX-1
      360 IF C$ = R$ AND PLAYERX<79 THEN PLAYERX=PLAYERX+1

      line 470 also appears to be missing some code…
      470 IF PLAYERX=<TRACK OR PLAYERX>=(TRACK+WID) THEN 490
      is what it should look like.

      So I’ve clearly made some mistake in formatting when I copied the code to the page. I’ll check it against my source and fix this page. In the mean time I actually have the source file for this available for download at the following link.

      http://sparcy.mooo.com/download/basic/SKING.BAS

      Sparcie

    • February 13, 2019 at 8:56 pm

      I think I understand where the problem came from! The < and > symbols in the code made wordpress display and store the code incorrectly. instead interpreting some sections as a HTML tag and removing parts it didn’t recognise. I’ve checked the code of this and ghost guzzler and fixed what I spotted was incorrect. Thanks for spotting the mistake, please let me know if you find any others.

      Sparcie

      • 4 evertonmarques
        February 13, 2019 at 11:22 pm

        Hey,

        Thanks for the original source file!
        I have downloaded it and the compiler handles it perfectly.
        It even spots a limitation in the compiler: it currently does not fully mimics the TAB() primitive.
        So the game can be compiled and runs as binary executable but it’s not playable yet.
        I’m thinkering on how to more closely reproduce the TAB() behavior.

        Thanks again,
        Everton


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.




Blogs I Follow

Enter your email address to follow this blog and receive notifications of new posts by email.


Mister G Kids

A daily comic about real stuff little kids say in school. By Matt Gajdoš

Random Battles: my life long level grind

completing every RPG, ever.

Gough's Tech Zone

Reversing the mindless enslavement of humans by technology.

Retrocosm's Vintage Computing, Tech & Scale RC Blog

Random mutterings on retro computing, old technology, some new, plus radio controlled scale modelling.

ancientelectronics

retro computing and gaming plus a little more

Retrocomputing with 90's SPARC

21st-Century computing, the hard way

lazygamereviews

MS-DOS game reviews, retro ramblings and more...

%d bloggers like this: