User Tools

Site Tools


sd:sd-8516_user_s_guide

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
sd:sd-8516_user_s_guide [2026/03/27 08:09] appledogsd:sd-8516_user_s_guide [2026/04/02 07:13] (current) appledog
Line 116: Line 116:
  
 === PRINT === PRINT
-**Getting Started – The PRINT Command**+**Getting Started -- The PRINT Command**
  
 The easiest way to make your SD-8516 say hello is with **PRINT**. You can also use the ? key as shorthand. The easiest way to make your SD-8516 say hello is with **PRINT**. You can also use the ? key as shorthand.
Line 139: Line 139:
  
 === GOTO === GOTO
-**Your First Program – The Never-Ending Message**+**Your First Program -- The Never-Ending Message**
  
 Let's write a real program. Type **NEW** and press ENTER to clear any old stuff. Let's write a real program. Type **NEW** and press ENTER to clear any old stuff.
Line 596: Line 596:
 | 1986 | WYSE WY-60             | 10 (USER) | 12 | 4 | | 1986 | WYSE WY-60             | 10 (USER) | 12 | 4 |
  
-=== Advanced Looping+=== More Loops
 Stellar BASIC V1 keeps things simple and fast; Originally there was not even a FOR-NEXT loop, and even now there is no WHILE or DO loop. But you can still create powerful repeating loops using just IF...THEN and GOTO. This section will demonstrate the kind of clever thinking you will need to write advanced programs in TinyBASIC. Stellar BASIC V1 keeps things simple and fast; Originally there was not even a FOR-NEXT loop, and even now there is no WHILE or DO loop. But you can still create powerful repeating loops using just IF...THEN and GOTO. This section will demonstrate the kind of clever thinking you will need to write advanced programs in TinyBASIC.
  
Line 631: Line 631:
 10 INPUT "ENTER A POSITIVE NUMBER ", N 10 INPUT "ENTER A POSITIVE NUMBER ", N
 20 IF N > 0 THEN GOTO 40 20 IF N > 0 THEN GOTO 40
-30 PRINT "TRY AGAIN – MUST BE POSITIVE!"+30 PRINT "TRY AGAIN -- MUST BE POSITIVE!"
 40 IF N <= 0 THEN GOTO 10 40 IF N <= 0 THEN GOTO 10
 50 PRINT "THANKS! YOU ENTERED "; N 50 PRINT "THANKS! YOU ENTERED "; N
Line 827: Line 827:
  
  
-== CHAPTER 4: ADVANCED STELLAR BASIC PROGRAMMING +== CHAPTER 4: How to write games in Stellar BASIC 
-** CHAPTER 4: ADVANCED BASIC PROGRAMMING** +In this chapter we will demonstrate some advanced programming techniques by writing a real game in Stellar BASIC. Today's game is ROBOT CHASE, the classic game that inspired BSDgames' 'robots'.
- +
-In this chapter we will demonstrate some advanced programming techniques by writing a real game in Stellar BASIC. Today's game is 'CHASE.BAS', the classic game that inspired BSDgames' 'robots'.+
  
 === robots or CHASE? === robots or CHASE?
-Robots is not an original game; it is a direct descendant of an earlier game called Chase, a turn-based pursuit game that likely originated in the early 1970s on the Dartmouth Time-Sharing System (DTSS) at Dartmouth College. The author of the original Chase remains unknown, but public versions appeared in Creative Computing magazine in 1976, with various modifications circulating afterward. Chase involved escaping from pursuing robots in a simple grid environment.+'Robotsis not an original game; it is a direct descendant of an earlier game called Chase, a turn-based pursuit game that likely originated in the early 1970s on the Dartmouth Time-Sharing System (DTSS) at Dartmouth College. The author of the original Chase remains unknown, but public versions appeared in Creative Computing magazine in 1976, with various modifications circulating afterward. Chase involved escaping from pursuing robots in a simple grid environment.
  
 === Development of the BSD Version === Development of the BSD Version
Line 882: Line 880:
 Let's make it more exciting; let's draw the player, and a robot. Let's make it more exciting; let's draw the player, and a robot.
  
-<codify BASIC+<codify BASIC>
     10 LET PX = 19     10 LET PX = 19
     20 LET PY = 11     20 LET PY = 11
Line 944: Line 942:
     240 RETURN     240 RETURN
  
-The above demo program checks for keys 10 times a second (WAIT 100). To check 50 times a second, try WAIT 20. Instead of WAIT, the program could be doing other things, like playing music or animating sprites! That's the power of a HASKEY loop -- but not every program needs to use that kind of input loop.+The above demo program checks for keys times a second (WAIT 200). To check 10 times a second, try WAIT 100 (i.e. 100ms). Instead of WAIT, the program could be doing other things, like playing music or animating sprites! That's the power of a HASKEY loop -- but not every program needs to use that kind of input loop.
  
 ==== Our ROBOTS input loop ==== Our ROBOTS input loop
Line 1095: Line 1093:
     4900 END     4900 END
  
-Finally, this would be a boring game if the robot didn't try and catch you! Here's how to make the robot move:+This would be a boring game if the robot didn't try and catch you! Here's how to make the robot move:
  
     140 REM MAKE ROBOTS MOVE     140 REM MAKE ROBOTS MOVE
Line 1106: Line 1104:
     7900 RETURN     7900 RETURN
  
-If you play the game, you will notice the collision check doesn't work. Why? It'because you are checking for collision on line 2500 before you move the robots. You need to check afterDelete line 2500 and type it in again as line 150: +And let'also add beep every time the robots move, to add to their dread. You can read more about the PLAY command in [[SD-8516 Stellar Basic#Music]].
  
 +    7100 PLAY "T120 W1 V5 O2 L24 B"
  
-=== ROBOTS.BAS Complete Program +If you play the game, you will notice the collision check doesn't workWhy? It's because you are checking for a collision on line 2500 before you move the robots. You need to check after. Delete line 2500 and type it in again as line 160:
-Here is the complete program:+
  
-<codify BASIC> +    160 REM CHECK FOR COLLISION 
-10 LET PX = 19 +    170 IF PX = RX THEN IF PY = RY THEN GOTO 4000
-20 LET PY = 11 +
-30 LET RX = 1 +
-40 LET RY = 1+
  
-100 REM DRAW MAP +After this, you have the basis for a playable game. You could add:
-110 GOSUB 1000 +
-120 REM GET PLAYER INPUT +
-130 GOSUB 2000 +
-140 REM MAKE ROBOTS MOVE +
-150 GOSUB 7000 +
-160 CHECK FOR COLLISION +
-170 IF PX = RX THEN IF PY = RY THEN GOTO 4000 +
-180 REM LOOP UNTIL QUIT +
-190 GOTO 100+
  
-1000 REM DRAW MAP +Levels with more robots -- using arraysfor example RX(3for the third robot's RX. 
-1005 VSTOP +* A stone (junk pilethat kills robots when they touch it (they crash). 
-1010 CLS +* Robot collisions which create crash-piles 
-1020 LET A = ASC("*") +Scores, including a hi-score list 
-1030 FOR X = 0 TO 39 +* A teleport function (max three times per level!
-1040 CHARXY X0, A +* Anything you can think of!
-1050 CHARXY X, 24, A +
-1060 NEXT X +
-1070 FOR Y = 0 TO 24 +
-1080 CHARXY 0, Y, A +
-1090 CHARXY 39, Y, A +
-1100 NEXT Y +
-1110 LET PC = ASC("@"+
-1120 LET RC = ASC("r") +
-1200 CHARXY PX, PY, ASC("@"+
-1300 CHARXY RX, RY, ASC("r") +
-1800 VSTART +
-1900 RETURN +
- +
-2000 REM *** SECTION B) INPUT LOOP +
-2010 LET K = GETKEY() +
-2015 IF K >= 97 THEN LET K = K 32 +
-2020 LET L = ASC("H"+
-2030 LET D = ASC("J"+
-2040 LET U = ASC("K"+
-2050 LET R = ASC("L"+
-2060 LET Q = ASC("Q"+
-2200 IF K = L THEN GOSUB 5000 : REM MOVE LEFT +
-2210 IF K = D THEN GOSUB 5100 : REM MOVE DOWN +
-2220 IF K = U THEN GOSUB 5200 : REM MOVE UP +
-2230 IF K = R THEN GOSUB 5300 : REM MOVE RIGHT +
-2240 IF K = Q THEN GOSUB 5400 : REM QUIT +
-2900 RETURN +
- +
-4000 REM ROBOT CATCHES YOU +
-4010 CLS +
-4020 ? "OH NOTHE ROBOT CATCHES YOU." +
-4030 ? "GAME OVER." +
-4900 END +
- +
-5000 REM MOVE PLAYER LEFT +
-5010 LET PX = PX - 1 +
-5020 IF PX < 1 THEN LET PX = 1 +
-5030 RETURN +
-5100 REM MOVE PLAYER DOWN +
-5110 LET PY = PY + 1 +
-5120 IF PY > 22 THEN LET PY = 22 +
-5130 RETURN +
-5200 REM MOVE PLAYER UP +
-5210 LET PY = PY - 1 +
-5220 IF PY < 1 THEN LET PY = 1 +
-5230 RETURN +
-5300 REM MOVE PLAYER RIGHT +
-5310 LET PX = PX + 1 +
-5320 IF PX > 38 THEN LET PX = 38 +
-5330 RETURN +
-5400 REM QUIT +
-5410 CLS +
-5420 PRINT "QUIT GAME" +
-5430 END +
- +
-7000 REM MAKE ROBOT MOVE TOWARDS PLAYER +
-7010 IF RX < PX THEN LET RX = RX + 1 +
-7020 IF RX > PX THEN LET RX = RX - 1 +
-7030 IF RY < PY THEN LET RY = RY + 1 +
-7040 IF RY > PY THEN LET RY = RY - 1 +
-7050 PRINT RX,RY +
-7900 RETURN +
-</codify>+
  
 +=== ROBOTS.BAS Complete Program
 +The source code for ROBOTS.BAS is listed on the BASIC Programs page:
  
 +* [[Stellar BASIC Programs]]
 +* Direct link: [[https://www.appledog.ca/wiki/doku.php?id=sdb:robots|ROBOTS.BAS source code]]
  
 == NEXT STEPS == NEXT STEPS
sd/sd-8516_user_s_guide.1774598946.txt.gz · Last modified: by appledog

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki