(The following Article was featured for the June '99 edition of this page)
A small Micro Color Basic Arcade Shoot-em up
Ok, so the following program does not exploit special features of the MC-10 and is not exactly an original idea as it is based on a Basic program that appeared in a TRS-80 Graphics book Radio Shack once sold. This was one of the first TRS-80 programs I converted and the MC-10 got first crack at the conversion, being this the first computer I ever owned. The concepts applied here consist of program structure disciplines in order to get the most of speed out of the execution times and one or two examples at how to build STRING$ using FOR-NEXT loops (the MC-10 does not have a STRING$ function).
The general layout of the program is: subroutines first, main loop in the middle and all variable definitions and general setup at the end. Using variables instead of numeric values speeds up the interpretation time of a Basic program and setting up the most often called subroutines right on the beginning of a program also contributes to enhanced response time from the computer. The listing (formatted as 32 characters per line):Â
MC-10 Laser Cannon
0 GOTO 100
25 IFI$<>" "THENGOSUB1:GOTO20
100 DIM ST$(15):CLEAR 2000:CLS 0
110 FOR I=1 TO 10
120 NEXT I
130 FOR I=2 TO 10
140 NEXT I
145 FOR I=1 TO 20
155 NEXT I
185 FOR I=1 TO 10
195 NEXT I
210 GOAT 5
220 GOAT 220
The screen consists of two rows of "moving" targets and a laser cannon activated by pressing the space bar. The top row of targets add 30 points and the bigger lower row of targets adds 20 points to the overall score - missing targets subtracts 10 points, be careful. The movement of the targets is accomplished by printing certain portion of each of the target strings and when a target is hit its space is replaced by blanks. Due to the hurry at the time when the program was written I didn't care of taking a close look at just how many targets appear per row and how the lower row should be treated in order to have whole targets right from the start; as it is, sometimes you can end up with a halved target - fair game though. Also, if the laser beam hits two targets (same column), the lower target takes the hit and the topmost is spared.
Line 102 has the number of shots available to the player. Variable B has the score and the reward and punishment level is set in lines 5, 6 and 55; if you feel like making the game tougher or easier you should adjust the plus/minus values in those lines affecting B. The laser beam in the original TRS-80 Model I/O game was made using the built in space compression and cursor control codes available in those machines; the MC-10 doesn't have those fancy features so a FOR NEXT with SET/RESET commands takes care of printing a whole column of laser characters from bottom to top and then erases the column in the same direction - the action is fast enough to rate in the arcade variety of effects; actually, I was surprised by the speed of the game after converting it from the TRS-80 Basic where the same version of the game runs a bit slower.
So here you have it - a blast from the past. Let me know what you think of these articles. I have many MC-10 Color Basic programs to share, perhaps an idea you might have has already been implemented. See you next month!