Poseidon's Wrath by Sander Alsema
About
--- Poseidon's Wrath ---
Written by Sander Alsema for the 10-liner competition 2021.
Language: Commodore 64 Basic v2
Category: PUR-80
--- Description & Instructions ---
These are dark times for the fabled sunken city of Atlantis. It is in great
peril of being invaded by evil purple squids. All that stands in their way
is Poseidon, Greek god of the oceans.
It is your sacred task to intercept the squids before they can cross the
screen. You do this by stabbing them with your trident.
Here's how you operate your harpoon:
- Press "<" to move to the left.
- Press ">" to move to the right.
- Press
If you fail to intercept one squid, you will lose the game.
But when you have intercepted fifty of them, you will win!
Unlike games that are in an infinite loop, where you just score points
until you die, this game actually has a victory condition.
This means you can win and feel really proud of what you have accomplished!
--- Code Explanation ---
Line 0: Read the data for the victory text string, the two squid animation
frame strings and the top part of the harpoon string.
Create the vertical orientation string and the bottom part of the
harpoon string.
Combine the top and bottom parts to form the complete harpoon
string.
Read the keyboard buffer to clear it.
Line 1: Clear the screen and display the number of squids slain.
Set the variable for the harpoon stab phase.
Set the variable for the bitwise animation frame indicator.
Set the variable for the harpoon length.
Set the variable for the horizontal position of the squid.
Set the variable for the vertical position of the squid with a
random value, taking the squid score in account; the higher the
score, the higher up the squid.
Set the variable for the horizontal position of the harpoon.
If the score has reached 50 then jump to line 8
Line 2: Display the harpoon.
Read a key from the keyboard.
If the key pressed was
with, then start the stabbing by initiating the stab phase.
Line 3: Display a squid animation frame. Which one is decided upon the
least significant bit of the frame indicator.
Set the variable for this least significant bit.
If the harpoon is being stabbed with, then calculate the length of
the harpoon and progress the stab phase.
Line 4: Set the background colour to cyan.
Move the squid to the right, depending on which frame is displayed.
Shift all bits in the frame indicator to the right and reset the
3rd bit, but only if the previous least significant bit was set.
If the key pressed was "," and the harpoon is not being stabbed
with and the harpoon is not to the far left, then move the harpoon
to the left.
Line 5: If the key pressed was "." and the harpoon is not being stabbed
with and the harpoon is not to the far right, then move the harpoon
to the right.
This line also contains data for the victory text string.
Line 6: Calculate the memory address of the screen position of the harpoon
tips.
If the character in that position is unequal to the other, two
positions to the right, and the harpoon is moving up then increase
the score and jump to line 1.
Line 7: If the squid has not reached the right side of the screen, then
jump to line 2.
This line also contains data for the two squid animation frame
strings.
Line 8: Clear the screen, display the number of squids slain and display
"GAME OVER".
If the score was 50, then display the victory text.
Line 9: Wait for a key to be pressed and restart the game.
This line also contains data for the top part of the harpoon
string.
---