--- Capitalist Pig ---

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

Language: Commodore 64 Basic v2

Category: PUR-80

--- Description & Instructions ---

On a farm in the poorest part of the country lives Francis the pig. By a

stroke of luck he has the opportunity to gather a decent amount of cash.

Usually farm animals don't know the value of money. This is where you come

in. Help Francis to bring home the bacon, and catch all the twenty-dollar

bills, which for some reason are blowing in the wind.

You do this by pressing:

- "Q" to stretch his arm.

- "A" to retract his arm.

Every time you catch a banknote, Francis will move to the right, making it

harder to catch the next one.

If you fail to catch a note, you will lose the game.

However, if you manage to catch twenty banknotes, 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 partial pig string, the paper money string

and the victory text string.

Make a string with quotation marks.

Use this string to complete the pig string.

In a loop, create the background string, which also doubles as a

vertical orientation string.

Line 1: In this same loop, create the partial arm string.

Complete the arm string with a hoof string.

Set the background colour to black.

Set the arm length variable.

Line 2: Clear the screen, display the dollar amount, the background and

the pig.

Randomly set the variable of the paper money altitude.

Set the variable for the horizontal position of the paper money

to the far right.

Line 3: Display the arm.

If the key pressed was "Q" and the arm is not fully stretched,

then stretch the arm.

Line 4: If the key pressed was "A" and the arm is not fully retracted,

then retract the arm.

Line 5: Display the paper money.

Move the paper money to the left.

If the money has reached the far left side of the screen, then

Line 6: If the character in the position just in front of the paper money

Line 7: Display the "OINK" text balloon.

Wait a short while.

Move the pig to the right.

If the pig has NOT yet reached the final position, then jump to

line 2.

Line 8: Clear the screen, display the dollar amount, the "GAME OVER" text

and the victory text (should this be the case).

Wait for a key to be pressed.

Line 9: Restart the game.

This line also contains data for the partial pig string, the paper

money string and the victory text string.

 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: Capitalist Pig.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.