Hippo Teeth
For some time, I had been thinking about writing a game for the CoCo 1/2, something I had not done in more than 5 years.And just as I was starting, "Retrochallenge RC2018/09" came around. I was unable to participate in previous editions, and I really wanted to be in this one.But the game I was working on was probably to big and complex to finish it on time.
I decided do a clone of sorts of an old hand-held LCD game I had back in the 80's, "Hippo Teeth", with the somewhat ambiguous goal of having it run in any CoCo with 16KB RAM.
You can read about the development in my blog, part 1, part 2, part 3, and ... part 3 again...
I wrote and tested the game using "VCC", a CoCo 3 emulator, and it was just some time later that I actually tested it in MESS. It was then that I realized that there is yet another "bug" in VCC, this time in the way that it handles keyboard detection.
Since I had to make some fixes, I went ahead and make a few changes and improvements.
In the end, I settled for having the game run in a 16 KB, Extended Color Basic CoCo - 32 KB if you want to use the disk version. It would not be hard to make it run in "regular" Color Basic, but the sound would not be that nice, and I just don't think it is a big deal.
The gameplay is quite simple. The cavity worm is eating the poor Hippo's teeth. You are the vet who is trying to get rid of the worm. If the tongue gets in your way, just spray somewhere else, to have the hippo move it away.
After you get 15 worms, there is a sort of "Bonus stage". For about 15-20 seconds the worm takes longer to eat the teeth, giving you an easier time.
COCO 3 COLORS



COCO 1/2 COLORS



Here is a .CAS file to play the game in a 16 KB CoCo, and a .DSK file for disk systems with at least 32 KB.
The game there is "compressed", that is, comments and most unnecessary spaces are removed, commands are crammed in a single line whenever possible, and lines are numbered 1 by 1. This makes it smaller and a bit faster, but also makes the code a lot hard to understand.
So, for all the comments below, I will refer to the "expanded" code.
Program Structure
Lines 10 to 25: Intro screen.Lines 95 to 499: Main loop.
Lines 500 to 720: Draw and erase graphics.
Lines 790 to 850: Change a few settings while in "Bonus stage".
Lines 1000 to 1135: Initialize graphics and variables.
Line 1000: Check if CoCo 1/2 or CoCo 3.
Line 1020: Load the background graphics.
Line 1055: If replaying, return here without reloading all the graphics.
Lines 1060 to 1131: Load graphics.
Lines 2000 to 2050: Game over.
Variables
P(3,5): Print @ position for each of the 3 possible horizontal positions of the 5 lines that make up the player character.P$(5): The 5 lines that make up the player character.
W(3,3): Print @ position for each of the 3 possible horizontal positions of the 3 lines that make up the worm character.
W$(3): The 3 lines that make up the worm character.
T(3,3): Print @ position for each of the 3 possible horizontal positions of the 3 lines that make up the tongue.
T$(3): The 3 lines that make up the tongue.
G(4,3): Print @ position for each of the 4 possible vertical positions of the 3 lines that make up the gas cloud.
G$(3): The 3 lines that make up the gas cloud.
CL$: 5 black spaces to delete text.
CB$: Used to delete the playe's feet.
D(1) to D(3): "Life" of each tooth.
DL: Speed at which the worm eats the tooth.
SI: How often to beep.
SC, HS: Score, High Score.
P,W,T: Player, worm and tongue position.
GV,GH: Gas cloud's vertical and horizontal position.
Other stuff
Here are some random facts about the game code.- As there is no "black space" character, I had to print CHR$(128). And since I used it so much, I defined S$ as CHR$(128).
- To detect keypress I'm PEEKing 343, 344 and 345. Seemed better than INKEY$, but VCC messes up the way this works. In real hardware, the value stored in those memory locations does not change until another key is pressed. That is why I'm resetting the values to 255 in line 95.
- Whenever any tooth's life becomes an exact multiple of 100 - D(W)/100=INT(D(W)/100) - one line of the tooth is deleted and the worms vertical position is moved up one line to match - FOR Q=1 TO 3:W(W,Q)=W(W,Q)-32:NEXTQ - in line 200.
- If a gas cloud reaches a tooth, the tongue will move 2 out of 3 times, but not to were the cloud hit, but to where the player is at the moment - line 480. Keep this in mind if you are trying to get the tongue out of the way.
- While in the "Bonus Stage", the speed at which the worm eats the tooth changes from 2.5 to 1, and a timer is set (line 800). Once the timer reaches 1000 - line 210 - it is reset back to 2.5.
- Line 1000 PEEKs &H8C1B to try to figure out if the computer is a CoCo 1/2 or 3, and set the correct high speed POKE. According to "Super Extended Basic Unravelled", that is one of the "sections of code where the Basic 1.2 and Extended Basic 1.1 ROMs differ from the bottom half of the CoCo 3 ROM". So far, this has worked in all the emulators I've tried, but I guess it can be broken by some ROM versions.