This article is to explain how I made Cookie Clicker C64 item buying more efficient. This probably isn’t the most interesting article, but you may enjoy it nonetheless.
Here is the layout of a page in the store:
1. Print a page in the store
2. Buy certain items depending on the pressed key (goes to sections 4-7)
3. Switch page if + or - is pressed
-------------------------
4. item 1 buying code
5. item 2 buying code
6. item 3 buying code
7. item 4 buying code
Now, this is for 1 page in a store. The store has over 5 pages… with 4 item buying routines each. Too much code, right? Well that's why I came up with an idea to make it better. First, let me explain how the store looks. You have 3 lines for each item. The setup is as follows:
Item Name Amount Owned Ex. Cursors 69 Description of item Adds .1 cookies per second Price of item 1000c
1. Select a range depending on the page selected. (0-3, 4-7, 8-12, etc)
2. Print the values in the range selected for each array
I will now add a for...next loop to handle all the menu printing. It will go through the range selected and print the desired values.
1. Reset x and read keyboard input
2. Exit on a change of the current page or menu
3. Enter buying routine if an item was selected. (if x=1-4)
1. Compare price and cookies
2. Subtract price
3. Add gain to gain.
4. Update amount owned.
5. Add 15% to price.
6. Update screen with new price and amount owned.
1. Load the item number. (y=i+x-1) (i is the low number in the range)
2. Compare price(y) with your total cookies. (see if you can buy it)
3. Subtract price(y) from your cookies. Add the gain to gain(y). Multiply price(y) by 1.15. Add one to the amount owned
4. Update the price and amount owned on the screen. (this takes up a few more lines to determine where the item you want updated is)
(What is the gain? With Cookie Clicker, an idle game, the game is always adding something to your total amount of cookies. This is your CpS, or in this case, Gain. I made it so each item has its own gain. (in this case, gain(y)) All gains are added, and that is the total gain. The total gain is added to the amount of cookies you have.)