--- Maternal Instinct ---

Written by Sander Alsema for the 10-liner competition 2022.

Language: Commodore 64 Basic v2

Category: PUR-80

--- Description & Instructions ---

In ancient China, farmers and dragons could peacefully coexist. Of course

there were some minor issues, but usually these could be easily overcome

with a little mutual understanding. This all changed when the farmers let

greed into their hearts, wanting more and more profit with no regard for

other species. Gradually dragons became obstacles rather than allies in the

eyes of the farmers, and had to be eliminated. And so the war began.

You are a female dragon, living in a cave in the vicinity of a small

village. From here fifteen farmers tracked you down and now, armed with

sticks, want to destroy your eggs. The only way to protect your offspring

is by spitting fire balls at the attackers.

PRESS 1-5 TO SPIT, where the number indicates the force with which this is

done.

At first the farmers are somewhat cautious. But whenever you hit one, the

next one will be more daring. If a farmer reaches your eggs, then you lose

the game. But should you manage to kill all fifteen of them, you will win.

--- Code Explanation ---

Line 0: Read data for the following strings:

Segment of the dragon's neck, pile of eggs and farmer.

In a loop:

Build the complete neck string, read and assemble the segment

strings of the dragon's head and build a vertical orientation

string.

Line 1: Set the background colour to black.

To save space further along in the program, set a variable to

screen memory.

Set character colour to yellow before clearing the screen, so that

a POKEd character on screen is immediately yellow.

Display the number of killed farmers, the pile of eggs, the neck

and the head of the dragon.

Set the farmer's horizontal position variable to the far left.

Line 2: Randomly calculate a new value for the farmer's horizontal

position. As the game progresses, the chance of this value being

forwards increases.

If this value is greater than zero then assign it to the farmer's

horizontal position variable and display the farmer.

Line 3: Set a string variable to hold the victory text.

If the fire mode is clear, then determine the value of the key

pressed. If this value is from 1 to 5, then set the fire mode,

set the horizontal and vertical position variables of the fire ball

to the front of the dragon's mouth and clear the gravity variable.

Line 4: If the fire mode is set and the position directly under the fire

ball is not clear (you hit a farmer), then increase the score. If

Line 5: If the fire mode is set, then clear the previous fire ball.

Decrease its horizontal position with the value of the key pressed.

Increase its vertical position with the gravity variable. Increase

the gravity variable. As a precaution, clear the fire mode. If the

vertical position is still on screen, then display the fire ball

and reset the fire mode.

Line 6: If the farmer has not reached your eggs and the score is less than

This line also contains data for the segment of dragon's neck

string and the pile of eggs string.

Line 7: This line also contains data for the farmer string.

If the score is fifteen, then set the final text string to the

victory text string. (you won the game)

Line 8: Clear the screen, display the number of killed farmers and

"GAME OVER". Also display the victory text, if appropriate.

Clear the keyboard buffer.

Wait for a key to be pressed.

Line 9: This line also contains data for the segment strings of the

Restart the game.

---

 Status Released Author BASIC 10Liner Genre Action Tags 8-Bit, basic, basic10liner, Commodore 64

## Install instructions

I prefer VICE, but you can use any emulator that works with *.d64 files.

If you haven't installed it yet, it can be downloaded from their website.

Here's how to use it:

Click : File -> Attach disk image -> Drive 8

Select: Maternal Instinct.d64

Click : Attach

Now, just as you would with a normal Commodore 64, you can type:

LIST                     (to view the directory or game listing)

RUN                      (to run the game)

Be aware that you are now using a virtual Commodore 64 keyboard.

Therefore the keys will differ slightly from your physical keyboard.

Use <SHIFT> '2' to display quotation marks.