124 lines
6.3 KiB
Plaintext
124 lines
6.3 KiB
Plaintext
___ ___ __ ___ ___ ____ ____
|
||
| \ / _] / ] | T T / T| \
|
||
| \ / [_ / / _____ | _ _ |Y o || _ Y
|
||
| D YY _] / / | || \_/ || || | |
|
||
| || [_ / \_l_____j| | || _ || | |
|
||
| || T\ | | | || | || | | by mcphail
|
||
l_____jl_____j \____j l___j___jl__j__jl__j__j btl AT mcphail.uk
|
||
|
||
- An exciting arcade game for the ZX Spectrum
|
||
------------------------------------------------------------------------------
|
||
|
||
You are DEC-Man and must search the haunted castle for delicious protein pills
|
||
whilst avoiding "Stinky", the terrifying ghost who will ruin your day! Use the
|
||
magical teleporter to zip to the other end of the main corridor to escape his
|
||
spectral clutches. If you survive, you get to come back another day!
|
||
|
||
---Controls-------------------------------------------------------------------
|
||
|
||
Up - "E"
|
||
Down - "D"
|
||
Left - "O"
|
||
Right - "P"
|
||
|
||
---Features-------------------------------------------------------------------
|
||
|
||
- Exciting action!
|
||
- Several colours!
|
||
- Thrilling* sound!
|
||
- An intelligent enemy who will hunt you down!
|
||
- Working teleporter!
|
||
|
||
* - not actually thrilling.
|
||
|
||
---Loading--------------------------------------------------------------------
|
||
|
||
The "decman.tap" file can be loaded in any standard ZX Spectrum emulator, of
|
||
which there are many. I recommend FUSE, which is available for Windows, Mac
|
||
and Linux. Alternatively, the "decman.wav" file can be played through the tape
|
||
socket of an original ZX Spectrum and loaded with 'LOAD ""' in the usual way.
|
||
The game will auto-run when loaded.
|
||
|
||
---Listing--------------------------------------------------------------------
|
||
|
||
Press "CAPS-Shift"+"SPACE" (Shift and Space on an emulator) to BREAK into the
|
||
program then type "LIST" (using the 'K' key) then "ENTER" to see the listing.
|
||
It can be seen that all lines are maximum 80 characters. For convenience, a
|
||
full listing is included in the "listing.txt" file which accompanies this
|
||
game. This has been produced using the "listbasic" utility from the FUSE
|
||
suite of tools. Note that line 1 has 4 extra colour-control characters added
|
||
which are represented in the listing as € symbols, to prove the 80-character
|
||
limit has not been exceeded.
|
||
|
||
---Submission-----------------------------------------------------------------
|
||
|
||
This game is being submitted for the 2026 BASIC 10Liner competition. It has
|
||
been written by me, mcphail, and is all my own work. No AI has been used in
|
||
the production of this game. I can be reached at "btl AT mcphail.uk".
|
||
|
||
It uses standard Sinclair BASIC, as shipped on the original 16 and 48K
|
||
ZX Spectrum computers in the UK.
|
||
|
||
I believe this submission meets all the criteria for the PUR-80 category.
|
||
|
||
---Notes----------------------------------------------------------------------
|
||
|
||
This game was written in VSCode using my "speccydev" dev container. The source
|
||
code and build system is available at:
|
||
https://boarstone.mcphail.uk/mcphail/BASIC10Liner2026 .
|
||
I used the "zmakebas" utility to build the code into the .tap file.
|
||
|
||
Sinclair BASIC is a poor choice for this competition due to its verbose
|
||
keyword structure, and the Spectrum is a tricky target as there are no subtle
|
||
ways to print characters to the screen without using lengthy "PRINT" commands.
|
||
Furthermore, there is no "ELSE" keyword so an "IF...THEN" construct
|
||
effectively ends a line. On the other hand, "DATA" statements can be placed
|
||
anywhere in the program and function definitions can be made before or after
|
||
the function is actually called. This allows the creative programmer to move
|
||
some data and logic to the dead spaces at the end of lines.
|
||
|
||
I only use 2 "IF...THEN" statements in the program. Most of the logic is
|
||
constructed using boolean comparisons as part of "LET" assignments. This saves
|
||
a little space and prevents premature line closure.
|
||
|
||
Most of the graphics are created by POKEing the screen attribute area to make
|
||
coloured blocks. It isn't pretty, but it is character-efficient and the
|
||
squares can be PEEKed for collision detection.
|
||
|
||
Lines 1-3 create the play board. The coordinates of the walls in the upper-
|
||
left quadrant are read in and mirrored to the other 3 quadrants. As there was
|
||
a little spare space in these lines, the defined function "b" is located here.
|
||
This will be described later.
|
||
|
||
Line 4 creates the teleport squares and starts the main game loop.
|
||
|
||
Line 5 reads the keyboard input. If a direction key is pressed, it uses
|
||
defined function "a" to check if that direction does not contain a wall and
|
||
sets the new intended character direction if that is the case. Line 6 will
|
||
keep the player going in the original direction if there has not been a valid
|
||
change in direction.
|
||
|
||
Line 7 teleports the player to the other end of the main corridor if they are
|
||
on the teleport square and prints the player at the new location.
|
||
|
||
Line 8 will move the ghost up or down to match the player's row if there is no
|
||
wall in the way. If the ghost cannot move up or down, it will try to move left
|
||
or right towards the player (calling defined function "b" to do this as there
|
||
was no space left on this line), again if there is no wall in the way. The
|
||
algorithm is a bit 'loose', which creates emergent behaviour where the ghost
|
||
will sometimes branch away from a pursuit and try to head-off the player at
|
||
the next corner, which is quite fun!
|
||
|
||
Line 9 will cause the ghost to back up a square if it cannot move towards the
|
||
player due to walls. This keeps the ghost in motion at all times. A check is
|
||
made for a player-ghost collision and the game restarted if that is the case.
|
||
|
||
Line 10 increments the pill counter if one has been eaten, and either restarts
|
||
the game loop or plays the victory sound if the board has been cleared. The
|
||
defined function "a" is stuck on the end here, and is used multiple times in
|
||
the program to check for wall collisions by player or ghost.
|
||
|
||
DEC-Man is, of course, a play on Pacman and "DEC" for "10", in the spirit of
|
||
the competition.
|
||
|
||
---Have fun and thanks for the opportunity to make this!---------------------- |