A downloadable game

Micro Gauntlet
10 Liner BASIC Contest 2021 - https://gkanold.wixsite.com/homeputerium
Category: WILD
Author: IvanBasic (Twitter @_IvanBasic_)
Platform: ZX Spectrum 48K
Language: Sinclair BASIC
Emulator advised: Spectaculator
Format: .tap
After loading, the game starts by itself since it was saved using SAVE "GAUNTLET" LINE 1
Controls: O-P-Q-A and M for using a potion.
The plot
As it is in the original game, run through as many stages as you can before your health is
Avoid the ghosts, they are slow enough to run across them, but if they touch you, your health
will lose 20 units; and if you hit them, 50 units of health will be lost.
Unfortunately, Elf cannot shoot (he was born with just 10 BASIC lines to define his features)
but someone has left magic potions than can make ghosts disappear (not forever, since they
will immediately appear from the bottom left part of the dungeon)
Collect keys to open doors.
You start the challenge having 1 key and 1 potion, and 999 units of health.
How many dungeons are you able to cross? Let's see…
The Code
Just 10 lines in Sinclair BASIC are quite challenging because this dialect lacks of ELSE command,
so using IF is very restricted (one per line as much), and you have to use many logical
functions, that make the code to be much slower.
Line 1: Sets the variables and the UDG, and prints the scoreboard for a new run.
Line 2: Sets the scoreboard for a new stage, and creates a random stage putting 1 potion, 3
keys and 10 doors. Maybe the potion and keys can be overlapped by walls and doors, so they
will be erased.
Line 3: Sets the variables for starting the stage, and puts the 20 ghosts into the dungeon.
Line 4: Ghosts' algorithm. Their coordinates are stored in a (20,3) matrix, first 2 elements are
y,x and the 3rd element means 1 if the ghost exists, or 0 if it does not exist (because he collided
with the Elf). In this line the ghost moves towards Elf, comparing y,x coordinates of both, and
checks if the ghost has touched Elf. Variables f and c set is the number of the ghost to be
moved in each loop. Variable l is +1 for going left, -1 for right. Variable v is +1 for down, and -1
for up.
Line 5: Elf's algorithm, checking pressed keys, and checking if a door was touched, opening it if
Elf has a key. Variable p is +1 for going left, -1 for right. Variable o is +1 for down, and -1 for up.
Line 6: Potion release. It checks if the potion key was pressed, in which case makes all ghosts
disappear, setting their new coordinates to the bottom left side of the dungeon.
Line 7: Erasing and printing the Elf in the new position, and checking if he is still alive (health
above 0, this is variable z)
Line 8: Checking ghosts contact. Variable w is the attribute of the new position of Elf, if it
matches Ghost color (white ink with bright, this is, ATTR=71) this means that Elf has touched a
ghost, losing 50 units of health. If health is lower than 1, game over message appears and a
new run starts.
Line 9: Checking exit. Idem, if w value is 7 (white ink, no bright) this means that Elf has reached
the exit pit, going to line 2 to create the new stage.
Line 10: Collecting key or potion. Attribute for key is 6 (yellow ink, no bright), and for potion is
1 (blue ink, no bright). Logical functions are used to increase k (keys) or q (potions) depending
on w. It prints the number of keys and potions, and makes the loop to line 4.
Rated 5.0 out of 5 stars
(1 total ratings)
AuthorBASIC 10Liner
Tags8-Bit, basic, basic10liner, sinclair, ZX Spectrum


Micro Gauntlet.tap 4 kB
Micro Gauntlet - IvanBasic.pdf 44 kB

Development log

Leave a comment

Log in with itch.io to leave a comment.