Version History

This is a page for the entire history of Fake Cookie Clicker Classic and its rebuilt version, Definitive Edition.

The naming convention used for these updates are as followed.

0.000x, where x is any number between 1-9 means it's an important update, example: Adding the grandma in version 0.0005, because that is an important thing. There are 5 of these updates, 2 if you don't count the prototypes.

0.000xy, where x is the same and y is also a number between 1-9 means it's a less important update, example: Adding a prototype stats screen in version 0.00042, because it's a little bit important but not as important as a building. There are 11 of these updates, 10 if you don't count the prototypes.

0.000xyz, where x and y are the same and z is also a number between 1-9 means it's an almost useless update, example: Fixing a bug where the Grandma didn't count towards the "Can We Fix It?" achievement in version 0.000511, because who would get the grandma before the cursor? There are 10 of these updates, with no prototypes at all.

and so on. There is only 1 update that doesn't fit into the categories above, and it only managed to get through because the last update for it was a 0.000xyz update.

## Fake Cookie Clicker Classic

### **Pre-release build:**

The pre-release build of Fake cookie clicker was made at school on Nov 19th, 2021. It was very primitive and only had the cursor and big cookie.

The inspiration for it was from the creator’s teacher not letting them play the real cookie clicker. This was where the creator thought "If I can't play it, then I'll make it myself." And thus, this dumpster dive version of a legendary game was born.

### **Full build:**

Version 1.0 was created on Nov. 20th, 2021, essentially acting as the pre-release build, "DX". This build adds Grandma and the farm, but that's about it.

Version 1.1 was the next important update, released exactly a week after version 1.0, which added the Mine and fixed a slight bug with the farm.

However, the next update wasn't until December 7th, 2021; Version 2.0, that, unlike it's name, was a very minor update. It "added" the golden cookie and fixed the colors for the background. Note the use of air quotes around the word "added".

The very next day, version 2.0.0.1 was released, where it made the golden cookie functional. Remember those air quotes around "added"? Well, it turned out that the golden cookie didn't actually do anything, so the creator "fixed" it. Once again, make note of the word in air quotes.

**THE. VERY. NEXT. DAY.** Version 2.0.0.2 was released. Remember how "fixed" was in air quotes? Well, it turned out that the multiplier of 777X production (at the time) was too overpowered, so the golden cookie was nerfed to only a 7X production multiplier. So, the golden cookie was fixed. For real this time!

On Jan. 1st, 2022, version 2.1 was released. Like 2.0, it was a small update, contrary to its name. It added the factory. That's it.

On Jan. 16th, 2022, version 2.1.1 was released. The update fixed a minor visual bug where the big cookie would freak out when clicked on and held by the edge.

On the 24th of April 2022, version 2.2 was released. The update added saving.

On the 15th of May 2022, version 3.0 was released and fixed the bug where buildings didn't work unless you clicked the flag twice.

### Version log

Along with this, there's also a version log in-game. Here it is:

1.0: Nov. 20, 2021: Released. Not sure if I will finish. Buildings available at launch: Cursor, Grandma, Farm

1.01: Nov. 23, 2021: Slight bug fixes.

1.1: Nov. 27, 2021: Bug fixes to the Farm, plus added the Mine.

2.0: Dec. 7, 2021: Added Golden Cookies, and fixed the colors for the background.

2.0.0.1: Dec 8, 2021: Made the Golden Cookie actually functional

2.0.0.2: Dec 9, 2021: Nerf'd the Golden Cookie

2.1: Jan 1, 2022: Added the Factory

2.1.1: Jan 16, 2022: Fixed a visual bug

2.1.2: Feb 19, 2022: Added a small announcement in the "README" sprite.

2.1.3: Mar 13, 2022: Added an update to the "README" sprite.

2.2: Apr 24, 2022: Added saving, AYOOOOOOOOO!

3.0: May 15, 2022: Fixed a major bug where Buildings wouldn't work, thank god.

## Fake Cookie Clicker Definitive Edition

### Prototypes

#### Prototype #1 (Baking start)

On January 28th, 2022, Jaydario created the first "Prototype" build of Fake Cookie Clicker Definitive Edition. It was extremely basic and bland, with it only having the big cookie and cookie counter. However, it laid out the building blocks for the later builds.

#### Prototype #2 (Chipped finish)

The same day, the next Prototype was made. This one was very unimportant, as the only change was that the chips on the cookie were finished.

##### Prototype #2.5 (Title to-do's)

As the name suggests, this one didn't add much. It was laying the groundwork for a full update. However, it added credits and a to do list in the code along with the rectangle that would later become the buy box for the cursor.

#### Prototype #3 (Graphic update)

This is the last Prototype, released the same day as the previous one, and like all of the other Prototypes, it was very minor. This one added extra graphics to get them ready for when the first big update was released.

### Version Releases

#### Version 0.00031 (Graphic update 2)

Unfortunately, the release date on this update is lost to time. This update added more graphics for when the big update was FINALLY finished.

### Version 0.0004 (AuTomatic Touchdown)

*Main article: Cursor#Fake Cookie Clicker Definitive Edition*
Remember that "big update" that was mentioned? That big update was the cursor being added. This update was added on February 4th, 2022, and added the functionality of the cursor granting you 0.1 CpS, but cursors didn't appear underneath the big cookie.

#### Version 0.00041 (Visual cookie cutter)

This one's release date is unknown, but most likely was quite quickly after 0.0004. It just made cursors appear underneath the big cookie.

#### Version 0.00042 (Statistical start)

This one came out sometime around February 9th, 2022, and added a prototype Stats Screen. The only stats shown were cookies in bank and all-time cookies baked.

##### Version 0.000421 (Graphic update 3)

This update came out on February 13th, 2022, and added some graphics for when the next big update was finished.

#### Version 0.00043 (Upgrade update)

*Main article: Upgrades*

This update was released around 45 minutes after 0.000421, on the same day. This one finished the "big update", that being the very first upgrade, for cookie clicks.

The upgrade didn't disappear when you clicked it but it did multiply the cookie clicks by 2. When you click it, it goes from the base cost of 100 cookies to 1000 cookies to 10000 cookies, or in e notation, going from 1e2 to 1e3 to 1e4 cookies.

#### Version 0.00044 (CpS clash)

*Main article: Upgrades*

This update was released on the 19th of February, 2022 and added the second upgrade in the game, the cursor upgrade.

The cursor upgrade makes the efficiency of the cursor doubled, and like the last upgrade it doesn't disappear when you buy it.

#### Version 0.00045 (Achievement acquisition)

*Main article: Achievements*

This update was released on the 8th of April 2022 and introduced 5 achievements out of more to come: one for baking a cookie (The equivalent of "Wake and bake"), one for purchasing a building (The equivalent of "Click or Grandma's cookies"), one for baking 100 cookies (The equivalent of "Making some dough", although the latter takes 1000 cookies to get), one for baking 10,000 cookies (The equivalent of "So baked right now"), and one for right clicking the cookie (Possibly the equivalent of "God complex", as both of them involve things that seem kinda obvious to do yet don't happen too often?).

### Version 0.0005 (Family business)

*Main article: Grandma#Fake Cookie Clicker Definitive Edition*
This update was released the very next day, April 9th, 2022, and as the name suggests, it was pretty big (for Definitive Edition standards.)

This was the update where Jaydario said "I think I've teased you guys enough", and added one of the most highly-anticipated features: THE GRANDMA (yeah, move over, grand dad.) Unfortunately, this didn't include its upgrade. Sad. Worse, it was quite buggy.

As well as the grandma, Jaydario added another achievement, "Won't Budge!" (The equivalent of God Complex but with Ortiel instead of Orteil).

There was a bug introduced in this update where the cursor CpS on the stats page was ten times the real cursor CpS.

#### Version 0.00051 (Cookie stand growth)

This update was released the same day as Version 0.0005, around 1-2 PM (EDT), and was released to fix a few bugs with the Grandma, including one that no one even had realized about (except for the creator)!

The first bug was where grandmas on the stats screen only counted as 0.1 CpS, when it's actually 1 CpS. The second bug fix was where the grandma's time counter's increment values were changed to be more accurate to 1 second.

As for the bug that no one noticed, it's where buying more than one grandma did nothing. It's surprising that no one but the creator noticed this, since it's a pretty major bug, but maybe it's better that way, since people were already crapping on the grandma.

##### Version 0.000511 (Equality for all)

This update was released on the same day as the last two, and fixed a glitch where the grandma didn't count towards the "Can We Fix It" achievement.

##### Version 0.000512 (Inflation equation)

This update was released on the same day as the last 3, and fixed a bug where you could get the "Won't Budge" Achievement infinitely, along with fixing a bug where if you ran the game in the background, you might not get some cookie achievements when you should've.

##### Version 0.000513 (Speedrunner sanctuary)

This update didn't actually update the gameplay, just added a "speedrunner's guide" to the title screen.

#### Version 0.00052 (Medal maker)

This update, released on April 18th, 2022, added 5 more Achievements, along with some clearer code comments in the Achievs object.

Which 5 Achievements did Jaydario add? Specifically, he added these: "Consolation Prize" (for playing the game, the equivalent of Wake and bake), "It's Over NINE!" (for baking 10 cookies, the equivalent of "Making some dough" as well), "Oh? You're approaching my cookies?" (for baking 1,000 cookies, the actual equivalent of "Making some dough"), "Squeak, Squeak" (for purchasing 1 cursor, the equivalent of Click), and "Ok boomer" (for purchasing 1 grandma, the equivalent of Grandma's cookies).

##### Version 0.000521 (Visual cookie cutter 2)

This update fixed the bug where the cursor didn't appear under the big cookie.

##### Version 0.000522 (Medal maker 2)

This update was created to make 2 more achievements, ("Much click. So wow." which is the equivalent of Double click but with 10 cursors instead of 2) and, what a surprise, ("Family business" for 10 grandmas, the name of Version 0.0005. Also the equivalent of Sloppy kisses except 5 times worse.)

#### Version 0.00053 (Cheat device)

This update was released on the 9th of April, 2022, and it made some cheats and also a shadow achievement, but even in the code it's unclear how to get any of them.

##### Version 0.000531 (Summer-ish cleaning update)

This update was released the next day, and cleaned up some code. It was also the first update to have an official name, which is the one you saw while reading the name of this version instead of a fan-made name in the last ones.

##### Version 0.000532 (Futureproofing Update)

This update's release date is unknown, but it was probably on May the 30th, 2022. It added a way to see all of the achievements, however instead of showing all of the achievements including the ones you don't have, it only shows the ones you do have. Three times in a row, for some reason.

#### Version 0.00054 (Gigantamax Evolve-able Grandmas)

This update was definitely released on May the 30th, 2022 and added an upgrade for the grandma. An upgrade... that didn't work because the creator forgot to add the thing that actually made grandmas super effective.

##### Version 0.000541 (Gigantamax Fix)

This update released on May the 31st, 2022 and fixed the upgrade added in the last update... but it still didn't update the stats CpS.

##### Version 0.000542 (And all that glitters looks old)

This update eleased around 12-1 PM EST on June 1st, 2022, and made the grandma's default color look less saturated and... older, with an extremely-light-pink mouth.

This update also fixed the previously-mentioned bug with the stats screen.

This update was originally proposed and coded (for the color changes) by wiki user A2A2tgt, with creator Jaydar modifying his code slightly with this update.

### There's also a version log in this game.

PATCH NOTES:

    V0.000542 (And all that glitters looks old): Changed the default color of the Grandma, and fixed a minor bug where grandma upgrades didn't affect your CpS in the Stats page.

        V0.000541 (Gigantamax Fix): Fixed the Grandma Upgrade.

        V0.00054 (Gigantamax Evolve-able Grandmas): I added an upgrade for the Grandma.

        V0.000532 (Futureproofing Update): As I'm worried of not being able to see all of the achievements, a way to see them all was added, for futureproofing.

        V0.000531 (Summer(-ish) Cleaning Update): Cleaned up a bit of code, more specifically, adding some sub-objects into the GameFunctions object, moving some functions into the same object, and making the first ever officially-named update! (also edited the patch notes for the previous update.)

        V0.00053: Added some cheats, and the first ever Shadow Achievement (hint: try a 'le hack'.)

        V0.000522: Added a couple achievements.

        V0.000521: Fixed a bug with the cursor.

        V0.00052: Added a lot more achievements (more specifically 5), along with a bit more clarification to the "Achievs" object.

        V0.000513: Added a "Speedrunner's Guide".

        V0.000512: Fixed a bug with the "Won't Budge" achievement where you could get it multiple times and fixed a bug where you might not get cookie achievements if you ran the game in the background.

        V0.000511: Fixed an extremely small bug with the "Can We Fix It?" Achievement.

        V0.00051: Fixed the Grandma (in multiple ways).

        V0.0005: Added Grandma and an extra Achieveeement.

        V0.00045: Added acheivements.

        V0.00044: Added upgrades for cursors.

        V0.00043: Added the fist upgrade of many to come, that upgrade being an upgrade to the cookie clicks.

        V0.000421: Added graphics for a prototype upgrade for cookie clicks

        V0.00042: Added the info board (kinda)

        V0.00041: Made cursors appear underneath the big cookie

        V0.0004: FINALLY FINISHED THE CURSOR (kinda, I need to add it underneath the cookie and add info when the buy icon is hovered over, but still!)

        V0.00031: Added more graphics for when I actually implement the cursor and changed to a version number rather than a prototype number

        V0.00030 (prototype 3): Tried to do more work, ended up doing about nothing

        V0.00025 (prototype 2.5): Added a rectangle

        V0.00020 (prototype 2): Finished the chips

        V0.00010 (prototype 1): Original prototype release

\*/

## Trivia

* Version 0.000513 is misspelled as Version 0.0000513 in Definitive Edition's code.
* There were 20 updates in Definitive Edition, and 9 in the original Scratch version.
	+ That makes for 29 updates in total, so let's do a stage by stage overview of them!
	+ The first ones, obviously as without the features in the first ones there would be nothing to do in the other updates succeeding them.
		- However, the most important first update was definitely the Scratch one which you can play right here, as it had both the Big Cookie and the cursor, two must-haves for gameplay that flows.
		- Compared with the Definitive Edition first update, which you can't play (although you can play the unimportant second update here), the Big Cookie is the only feature making cookies as worthless as a piece of fluff. (Update: A2A2tgt found the (presumably) first edition! You can play it here: https://www.khanacademy.org/computer-programming/cookie-clicker-definitive-edition-pre-release-prototype-1/5585832888025088)
	+ The second update in the Scratch version was pretty important as it added both the Grandma, one stage of flowing gameplay, and the farm, the second. Compared to the aforementioned "unimportant" second update which just fixed the chips, that's good progression.
	+ The third update was the same as the second update in goodness terms, as the Scratch third update added The "5.875 times better than the farm" Mine while the Definitive third update was just adding a credits and to do list along with a rectangle that had no use until 3 updates later.
	+ The fourth update was the first unimportant Scratch update, as it tried and failed to add the golden cookie along with changed the background. Compared with the Definitive fourth update which made the buy box a buy box (while still not having the cursor), this is the first (albeit close) win for Definitive.
	+ The fifth update in the Scratch version fixed the Golden cookie... too much. Meanwhile the Definitive fifth update added more graphics "for when the big update was finally finished" so stop the celebrations as the king has won the battle.
	+ The sixth update in the Scratch version finally fixed the Golden Cookie which makes it lose points for taking 3 updates to implement a single feature correctly. Meanwhile, this is the second important update for Definitive Edition, meaning that the king has a contender for the throne. Better wait out the battle.
	+ The seventh update in the Scratch version added The "5.5319149 times better than the mine" Factory which is a pretty big step in the flow of buildings. The Definitive equivalent for this was making the cursor appear underneath the big cookie, meaning it took seven updates to reach the level of Scratch's first update. The king is still reigning supreme!
	+ The eighth update in Scratch was just a bug-fixing update that fixed a single, unknown bug. Compared to the eighth Definitive update which added a prototype Stats screen. The king is still in danger because now, it's 5-3!
	+ The ninth update in Scratch added saving, which is quite an important feature for a game aiming to be as big as Cookie Clicker. However, the Definitive equivalent was weak, just adding more graphics for the next big update. It's 6-3, you can rest. **Wait, you're forfeiting?**
	+ As it turns out, that was the last update in Scratch. The king is easily intimidated I guess. However, Definitive Edition was clearly itching for a fight as the next update was the third big update, which added the clicking upgrade. Not too important for update 10.
	+ Clever strategy, splitting 1 big update into two big parts so you can get two wins and have a better chance. Anyway, this was the fourth big update, which added another upgrade, the cursor upgrade. 11th update, more than halfway there.
	+ But they didn't stop there, 3 big updates in a row? This was the 12th update and the achievement update, pretty important.
	+ If you're gonna do something, do it again. 4th big update in a row, this time it's the grandma update. This is the 13th update, meaning it took 13 updates to reach the level of Scratch's second update, meaning Definitive is 6 times slower than Scratch.
	+ The 14th update just cleant up the last update by a LOT. The relationship between this update and the last update is like the relationship between the fourth Scratch update and the fifth and sixth Scratch update combined.
	+ The 15th update cleant up the last update by a little. It just fixed a bug where you didn't get the "Can You Fix It" achievement from the grandma.
	+ The 16th update was a small bug-fixing update.
	+ The 17th update was the sequel to the 3rd update, where it didn't change anything in the game.
	+ The 18th update was the sequel to the 12th update, adding more achievements.
	+ The 19th update did the 7th update all over again.
	+ The 20th update was the sequel to the 18th update, adding 2 more achievements.

The scores are: 6-13, although the scores were inflated from an early forfeit by Scratch so in reality it's more like 6-3. The king still reigns supreme, kind of?

## References List

1. ↑ See Jaydario's discussion page post from April 2022
2. ↑ Wake and bake is the first and easiest achievement you get, assuming you're not doing a True Neverclick run
3. ↑ This update wasn't actually documented in the version history part of the code until some time later
4. ↑ This is also the first update where A2A2tgt decided to preserve the code for history preservation purposes. Here is the code for version 0.000531 in its entirety:

/\*

            this effect doesn't work properly on mobile devices, sorry mobile players:

              \_\_\_\_\_\_\_

             /       \

             \\_\_\_\_\_\_\_/

        \_\_     \_\_\_           \_\_

       |\_\_   /     \   | /  |\_\_

        \_\_   \_\_\_    \_\_\_         \_\_ \_\_    \_\_

        \_\_         \_\_ \_\_   \_\_          \_\_    \_\_

    A JAYDAR STUDIOS GAME

    FAKE COOKIE CLICKER DEFINITIVE EDITION, COPYRIGHT 2022, JAYDAR STUDIOS, INC.

	* /

/\*\*

    PATCH NOTES:

        V0.000531 (Summer(-ish) Cleaning Update): Cleaned up a bit of code, more specifically, adding some sub-objects into the GameFunctions object, moving some functions into the same object, and making the first ever officially-named update! (also edited the patch notes for the previous update.)

        V0.00053: Added some cheats, and the first ever Shadow Achievement (hint: try a 'le hack'.)

        V0.000522: Added a couple achievements.

        V0.000521: Fixed a bug with the cursor.

        V0.00052: Added a lot more achievements (more specifically 5), along with a bit more clarification to the "Achievs" object.

        V0.000513: Added a "Speedrunner's Guide".

        V0.000512: Fixed a bug with the "Won't Budge" achievement where you could get it multiple times and fixed a bug where you might not get cookie achievements if you ran the game in the background.

        V0.000511: Fixed an extremely small bug with the "Can We Fix It?" Achievement.

        V0.00051: Fixed the Grandma (in multiple ways).

        V0.0005: Added Grandma and an extra Achieveeement.

        V0.00045: Added acheivements.

        V0.00044: Added upgrades for cursors.

        V0.00043: Added the fist upgrade of many to come, that upgrade being an upgrade to the cookie clicks.

        V0.000421: Added graphics for a prototype upgrade for cookie clicks

        V0.00042: Added the info board (kinda)

        V0.00041: Made cursors appear underneath the big cookie

        V0.0004: FINALLY FINISHED THE CURSOR (kinda, I need to add it underneath the cookie and add info when the buy icon is hovered over, but still!)

        V0.00031: Added more graphics for when I actually implement the cursor and changed to a version number rather than a prototype number

        V0.00030 (prototype 3): Tried to do more work, ended up doing about nothing

        V0.00025 (prototype 2.5): Added a rectangle

        V0.00020 (prototype 2): Finished the chips

        V0.00010 (prototype 1): Original prototype release

	* /

/\*

    To do (most important to least important):

    Add saving

    Fix the big cookie's hitbox to make it a circle

    Add SFX

    Once the info board is added, I need to make sure the cookie count text doesn't overlap with the info board.

    Add the news ticker

    Add particles

    Add bulk buying

    Add debug features

    Maybe create a seperate website for this game????? (I'm kinda limited in Khan Academy)

	* /

/\*

    DONE (oldest to latest):

    Finish the Cursor

    Add the info board (sorta)

    Added an upgrade for clicking the cookie! (HERE COMES THE HYPE TRAIN!!!!!!!!!!!!!!)

    Added an upgrade for the cursor (THOMAS THE HYPE TRAIN LEVELS OF HYPE)

	* /

/\*\*

    And now, the offical speedrunner's guide to DE speedruns, made by Jaydar:

        SPEEDRUN CATEGORIES:

    10K cookies (earn 10 thousand cookies all-time w/o messing with the code.)

    1M cookies (earn 1 million cookies all-time w/o messing with the code.)

    All Achievements (Earn every achievement in the game w/o messing with the code.)

        SUBCATEGORIES:

    Any% (beating that category in any way, while still obeying the main category's rules)

    Low click% (beating that category while clicking the cookie the least amount of times)

        CATEGORY EXSTENSIONS:

    ACE (Messing with the game's code to get to 1 Million cookies. Cookie clicks are NOT ALLOWED!)

    short% (An extremely short run where you have to get these achievements: "Bakeginner", "Nice try", and "Won't Budge!")

    timetravel% (A run where you have to get 10 cookies in every version of the game.)

    That's it; enjoy running these categories soon!

    NOTE: Speedrun leaderboards on speedrun.com aren't ready yet, but you can still record speedruns in advance.

	* + /

/\*\*

        FEATURES:

    - A big cookie

    - Buyable Cursors and Grandmas

    - Upgrades

    - Stats

    - Achievements

    - Cookies

    - And soon enough, speedrun.com leaderboards(?)! (The future for speedrun leaderboards are uncertain right now.)

/\*\*

                CREDITS:

Cookie clicker is by Orteil, I have his thanks for this project, as it's his concept.

Fake Cookie clicker and Fake Cookie Clicker: Definitive Edition by me, copyright 2021 - 2022.

Code is by me, unless I say "This code is by (so and so)."

Graphics are by me.

	* /

//enough boring stuff, here comes the code:

//this sets the fps cap to 30 (like in OG cookie clicker)

var fpsCap = 30;

//variables for the cookie's location

var cookieSize = 135;

var cookieX = 70;

var cookieY = 300;

    //variables for the cookie's (currently slightly janky) hitbox

    var cookieHitboxX1 = cookieX - 45;

    var cookieHitboxX2 = cookieHitboxX1 + cookieSize;

    var cookieHitboxY1 = cookieY - (cookieSize / 2);

    var cookieHitboxY2 = cookieY + (cookieSize / 2);

    //cookie count setup

    var cookies = 0;

    //all time cookies setup

    var allTimeCookies = 0;

    //cookies per second setup

    var CpS = 0;

    //variables for the chips

    var chipX = 30;

    var chipY = 35;

    var chipRad = 120;

//variables for the building buy icon

var buyX = 395;

var buyY = 265;

var buyW = 205;

var buyH = 75;

//variables for the cursor

var cursors = 0;

var cursorPrice = 15 + (cursors \* 2);

//variables for the building buy icon's hitbox

var buyHBX1 = buyX;

var buyHBX2 = buyHBX1 + buyW;

var buyHBY1 = buyY;

var buyHBY2 = buyHBY1 + buyH;

//buy things font

var font1 = createFont("monospace", 18);

//cookie count font

var font2 = createFont("sans-serif", 10);

//this function draws the cursor

var drawCrsr = function(crsrX, crsrY, crsrHue1, crsrHue2, crsrHue3) {

    strokeWeight(1);

    fill(crsrHue1, crsrHue2, crsrHue3);

    //base of the cursor

    ellipse(crsrX, crsrY, 72, 45);

    //the fingers (YES I KNOW THERE'S ONLY 4 FINGERS I'M JUST TOO LAZY TO ADD ANOTHER)

    rect((crsrX + 13) - 45, (crsrY + 48) - (45 \* 2), 20, 32);

    rect((crsrX + 33) - 45, (crsrY + 39) - (45 \* 2), 20, 32);

    rect((crsrX + 51) - 45, (crsrY + 45) - (45 \* 2), 20, 32);

    rect((crsrX + 65) - 45, (crsrY + 53) - (45 \* 2), 20, 32);

};

//Timer for the cursor

var CrsrTime = 0;

//grandma stuff

//pos

var buy2Y = buyY + 75;

//price

var gMaPrice = 100;

//# owned

var gMas = 0;

//draw grandma

var drawGMa = function(gMaX, gMaY, gMaH1, gMaH2, gMaH3) {

    fill(gMaH1, gMaH2, gMaH3);

    ellipse(gMaX, gMaY, 65, 65);

    fill(191, 242, 239);

    ellipse(gMaX - 13, gMaY - 11.5, 15, 15);

    ellipse(gMaX + 13, gMaY - 11.5, 15, 15);

    fill(0, 0, 0);

    arc(gMaX, gMaY - 10, 15, 0, 0, 180);

};

//hitboxes

var buy2HBX1 = buyX;

var buy2HBX2 = buyX + buyW;

var buy2HBY1 = buy2Y;

var buy2HBY2 = buy2Y + buyH;

var gmaTime = 0;

//Tracks the upgrade level of clicking the cookie

var clickLvl = 1;

//tracks the price of the click upgrade

var clickUpPrice = 100;

//Tracks the pos of the click upgrade's triangle

var clickX = 424;

var clickY = 97;

//tracks the upgrade level of the cursor

var crsrLvl = 1;

//variables for the click upgrade's hitbox

var clickUpHBX1 = clickX - 25;

var clickUpHBX2 = clickUpHBX1 + 72;

var clickUpHBY1 = clickY - 10;

var clickUpHBY2 = clickUpHBY1 + 101;

//tracks the price of the cursor uprade

var crsrUpPrice = 250;

//tracks the x pos of the cursor upgrade

var crsrUpX = clickX + 51;

//variables for the cursor upgrade hitbox

var crsrUpHBX1 = crsrUpX;

var crsrUpHBX2 = crsrUpHBX1 + 84;

var crsrUpHBY1 = clickY;

var crsrUpHBY2 = crsrUpHBY1 + 101;

//Building count

var buildings = 0;

//Achievement handling (part 1)

//array that displays Achievements on the stats screen, as names and requirements are added to the array.

var Achieves = [];

//an object that stores Achievements. I abbreviated the names in the code, but I'll use comments to display the achievement's actual name for you fellow nosy nerds. (You're welcome, by the way!)

var Achieved = {

    consPrize: "false", // This is for "Consolation Prize"

    bakeginner: "false", // This is for "Bakeginner"

    overnine: "false", // This is for "It's over NINE!"

    approach: "false", // This is for "Oh? You're approaching my cookies?"

    rollDough: "false", // This is for "Rolling In The DOUGH"

    toFeed: "false", // This is for "Enough To Feed A Highschool"

    fixIt: "false", // This is for "Can We Fix It?"

    squeakSqueak: "false", // This is for "Squeak, Squeak"

    muchClick: "false",

    okBoomer: "false", // This is for "Ok Boomer"

    famBuis: "false",

    nicetry: "false", // This is for "Nice Try"

    wontbudge: "false", // This is for "Won't Budge"

    rotDough: "false"

};

//This one is full of cheats and other misc. functions for screwing around.

var gameFunctions = {

    inGameStuff: {

        Rot\_The\_Dough: function(ruinTxt) {

            if (Achieved.rotDough === "false") {

                Achieved.rotDough = "true";

                var sndPly = function() {

                    var snd2 = getSound("retro/coin");

                    snd2.audio.volume = 1;

                    snd2.audio.preservesPitch = false;

                    snd2.audio.playbackRate = 0.5;

                    playSound(snd2);

                };

                sndPly();

                Achieves.push("\nRotten Dough (Shadow Achievement)");

            }

            if (ruinTxt === true) {

                println("Great job, you frickin idiot. You ruined any and all fun you could've had.\nFor your dastardly deeds, take this special Shadow Achievement as a badge that will \nwarn everyone to stay away from you. \nSorry, I got off on a tangent there. I'm just saying, you're missing out. \nAnyways, I gotta go. Once again, sorry for the tangent. Keep on clicking, and enjoy this stupid game! - Jaydar");

            }

        },

        //this just plays the SFX for Achievements

        playChiev: function() {

            var snd = getSound("retro/coin");

            snd.audio.volume = 0.095;

            snd.audio.playbackRate = 1;

            playSound(snd);

        },

        //This unlocks "Nice Try!"

        unlocknicetry: function() {

            Achieved.nicetry = "true";

            Achieves.push("\nNice Try (Right-click the cookie)");

            gameFunctions.inGameStuff.playChiev();

        },

        //This function unlocks "Won't Budge!"

        unlockwontbudge: function() {

            Achieved.wontbudge = "true";

            Achieves.push("\nWon't budge! (Middle-click the cookie after right-clicki\n-ng it)");

            gameFunctions.inGameStuff.playChiev();

        }

    },

    properCheats: {

        Spill\_The\_Milk: function() {

            cursors += 500000000;

            gMas += 50000000;

            cookies = 9999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999;

            gameFunctions.inGameStuff.Rot\_The\_Dough(true);

            allTimeCookies = cookies;

        }

    },

    other: {

        Blast\_To\_The\_Past: function() {

            Program.restart();

        }

    }

};

//where the true magic happens

var draw = function() {

    strokeWeight(1);

    stroke(0, 0, 0);

    background(120, 194, 255);

    frameRate(30);

     if (mouseIsPressed && mouseX > cookieHitboxX1 && mouseX < cookieHitboxX2 && mouseY > cookieHitboxY1 && mouseY < cookieHitboxY2 && mouseButton === LEFT){ //detects when you click on the cookie's hitbox

        cookieSize = 75; // makes the cookie smaller

        //changing stuff with the chips

        chipRad = 65;

        chipX = 18;

        chipY = 26;

    } else {

        cookieSize = 135; //makes the cookie its normal size

        //setting stuff with the chips to normal

        chipRad = 120;

        chipX = 30;

        chipY = 35;

    }

    //buy icon

    fill(61, 155, 255);

    rect(buyX, buyY, 204, buyH);

    fill(255, 255, 255);

    //price text

    textFont(font1);

    text(cursorPrice + " Cookies", buyX + 15, buyY + 65);

    //title for the buy icon

    textFont(font1);

    text("Cursor", buyX + 31, buyY + 14.3);

    //cursor count text

    textSize(28);

    text(cursors, buyX + 9, buyY + 36);

    //calls the function to draw the cursor (see way earlier in the code)

    drawCrsr(550, 315, 255, 255, 255);

    fill(61, 155, 255);

    rect(buyX, buy2Y, 204, buyH);

    fill(255, 255, 255);

    //price text

    textFont(font1);

    text(gMaPrice + " Cookies", buyX + 15, buy2Y + 65);

    //title for the buy icon

    textFont(font1);

    text("Grandma", buyX + 31, buy2Y + 14.3);

    //cursor count text

    textSize(28);

    text(gMas, buyX + 9, buy2Y + 36);

    //calls the function to draw grandma

    drawGMa(550, 380, 255, 0, 239);

    //shhhhhhhhhhh don't look or change, it's debug text

    fill(130, 193, 255);

    text(CrsrTime, 200, 200);

    //cookie count text

    fill(255, 255, 255);

    textFont(font2);

    textAlign(CENTER);

    text("Cookies: " + cookies, cookieX, 45);

    //nothing special

    textAlign(LEFT);

    //sets the framerate to the fps cap

    frameRate(fpsCap);

    //draws the cursors below the big cookie

    var crsrY2 = 417;

    for (var rep = 0; rep < cursors && rep < 5; rep++) {

        drawCrsr(cookieX, crsrY2, 255, 255, 255);

        crsrY2 += 75;

    }

    //the base of the cookie

    fill(173, 151, 26);

    ellipse(cookieX, cookieY, cookieSize, cookieSize);

    //sets the CpS

    CpS = ((round(cursors \* crsrLvl) / 10) + gMas);

    //the chips in the cookie

    fill(135, 76, 10);

    ellipse(cookieX - chipX, cookieY - chipY, cookieSize - chipRad, cookieSize - chipRad);

    ellipse(cookieX, cookieY, cookieSize - (chipRad - 21), cookieSize - (chipRad - 21));

    ellipse(cookieX + chipX, cookieY - 25, cookieSize - (chipRad - 4.25), cookieSize - (chipRad - 4.25));

        //how cookies are gained

        mouseClicked = function(){

        if (mouseX > cookieHitboxX1 && mouseX < cookieHitboxX2 && mouseY > cookieHitboxY1 && mouseY < cookieHitboxY2 && mouseButton === LEFT){

            cookies += 1 \* clickLvl;

            allTimeCookies += 1 \* clickLvl;

        } else if(mouseX > cookieHitboxX1 && mouseX < cookieHitboxX2 && mouseY > cookieHitboxY1 && mouseY < cookieHitboxY2 && mouseButton === RIGHT && Achieved.nicetry === "false"){ //"Nice Try" Achieveement

                gameFunctions.inGameStuff.unlocknicetry();

        } else if(mouseX > cookieHitboxX1 && mouseX < cookieHitboxX2 && mouseY > cookieHitboxY1 && mouseY < cookieHitboxY2 && mouseButton === CENTER && Achieved.nicetry === "true" && Achieved.wontbudge === "false") { //"Won't Budge!" Achieveement

                gameFunctions.inGameStuff.unlockwontbudge();

            //how cursors are gained

            } else if (mouseX > buyHBX1 && mouseX < buyHBX2 && mouseY > buyHBY1 && mouseY < buyHBY2 && cookies >= cursorPrice){

                cursors += 1;

                cookies -= cursorPrice; //takes away cookies

                cursorPrice = 15 + (cursors \* 2); //changes the price

                buildings += 1;

            } else if (mouseX > buy2HBX1 && mouseX < buy2HBX2 && mouseY > buy2HBY1 && mouseY < buy2HBY2 && cookies >= gMaPrice) {

                gMas += 1;

                cookies -= gMaPrice;

                gMaPrice = 100 + (gMas \* 15);

                buildings += 1;

            }

        };

            //grandma timer

            if (gmaTime >= 1) {

                if (gMas >= 1) {

                    cookies += 1;

                    allTimeCookies += 1;

                }

                gmaTime = 0;

            } else {

                gmaTime += 0.04 \* gMas;

            }

            //the timer for the cursor I worked so hard on (this is the main reason I'm making my own site)

            if (CrsrTime >= (10 / cursors)){

                if (cursors >= 1){

                    cookies += crsrLvl;

                    allTimeCookies += crsrLvl;

                }

                CrsrTime = 0;

            } else {

                CrsrTime += (1 / fpsCap);

            }

            //stats screen

            //acheivement handler (part 2, go back to somewhere near line 210 for part 1)

        //Cookie Achievements

            if (allTimeCookies >= 1 && Achieved.bakeginner === "false") {

                Achieved.bakeginner = "true";

                Achieves.push("\nBakeginner (bake 1 cookie)");

                gameFunctions.inGameStuff.playChiev();

            } else if (allTimeCookies >= 10 && Achieved.overnine === "false") {

                Achieved.overnine = "true";

                Achieves.push("\nIt's Over NINE! (bake 10 cookies)");

                gameFunctions.inGameStuff.playChiev();

            } else if (allTimeCookies >= 100 && Achieved.rollDough === "false") {

                Achieved.rollDough = "true";

                Achieves.push("\nRolling In the DOUGH (bake 100 cookies)");

                gameFunctions.inGameStuff.playChiev();

            } else if (allTimeCookies >= 1000 && Achieved.approach === "false") {

                Achieved.approach = "true";

                Achieves.push("\nOh? You're approaching my cookies? (bake 1,000 c\n-ookies)");

                gameFunctions.inGameStuff.playChiev();

            } else if (allTimeCookies >= 10000 && Achieved.toFeed === "false") {

                Achieved.toFeed = "true";

                Achieves.push("\nEnough to feed a highschool (bake 10,000 cookies)");

                gameFunctions.inGameStuff.playChiev();

        //Building Achievements

            } else if (buildings >= 1 && Achieved.fixIt === "false") {

                Achieved.fixIt = "true";

                Achieves.push("\nCan We Fix It? (Purchase a building)");

                gameFunctions.inGameStuff.playChiev();

            } else if (cursors >= 1 && Achieved.squeakSqueak === "false") {

                Achieved.squeakSqueak = "true";

                Achieves.push("\nSqueak, Squeak (purchase 1 cursor)");

                gameFunctions.inGameStuff.playChiev();

            } else if (cursors >= 10 && Achieved.muchClick === "false") {

                Achieved.muchClick = "true";

                Achieves.push("\nMuch click. So wow. (Own 10 cursors)");

                gameFunctions.inGameStuff.playChiev();

            } else if (gMas >= 1 && Achieved.okBoomer === "false") {

                Achieved.okBoomer = "true";

                Achieves.push("\nOk Boomer (Purchase 1 grandma)");

                gameFunctions.inGameStuff.playChiev();

            } else if (gMas >= 10 && Achieved.famBuis === "false") {

                Achieved.famBuis = "true";

                Achieves.push("\nFamily Buisness (Own 10 grandmas)");

                gameFunctions.inGameStuff.playChiev();

            } else if (millis() >= 1 && Achieved.consPrize === "false") {

                Achieved.consPrize = "true";

                Achieves.push("\nConsolation Prize (Boot up this game)");

                gameFunctions.inGameStuff.playChiev();

            }

            strokeWeight(3);

            var statX = 140;

            var statY = 1;

            fill(179, 118, 6);

            rect(statX, statY, 255, height - 1);

            fill(255, 255, 255);

            //title

            textSize(25);

            text("Stats", statX + 30, statY + 30);

            //actual stats text

            textSize(10);

            text(cookies + " cookie(s) in bank", statX + 10, statY + 72); //cookies in bank

            text(allTimeCookies + " cookie(s) baked (all time)", statX + 10, statY + 97); //all time cookie(s)

            text("CpS: " + CpS, statX + 10, statY + 118);  //CpS

            text("Buildings: " + buildings, statX + 10, statY + 139); //buildings

            text("Achievements (" + Achieves.length + "/" + (Object.keys(Achieved).length - 1) + "): " + Achieves, statX + 10, statY + 160); //I use all of these .length functions so that I can easily track how many Achievements you have to how many total are in the game. Also thanks to KA user "Kopter Coding" for the help with the total achievement count (with the Object.keys() part.)

            //cookie click upgrade icon code

            //the box around the upgrade's icon

            fill(117, 61, 6);

            stroke(26, 18, 0);

            strokeWeight(4);

            rect(clickX - 25, clickY, 53, 101);

            //the upgrade's actual icon

            strokeWeight(1);

            stroke(0, 0, 0);

            fill(44, 232, 242);

            rect(clickX - 10, clickY + 55, 25, 35);

            triangle(clickX - 10, clickY + 10, clickX - 10, clickY + 68, clickX + 16, clickY + 58);

            if (mouseX >= clickUpHBX1 && mouseX <= clickUpHBX2 - 15 && mouseY >= clickUpHBY1 && mouseY <= clickUpHBY2) {

                //info about the upgrade

                fill(117, 61, 6);

                stroke(26, 18, 0);

                strokeWeight(4);

                rect(clickX - 27, clickY - 96, 75, 93);

                fill(255, 255, 255);

                text("Clicking upgrade", clickX - 25, clickY - 88);

                text("Clicking upgrade", clickX - 25, clickY - 88);

                text("This makes click\n-ing the cookie\n2X as effective.", clickX - 25, clickY - 72.5);

                text(clickUpPrice + "\ncookies to buy", clickX - 25, clickY - 23.3);

                    if (cookies >= clickUpPrice && mouseIsPressed) {

                        clickLvl \*= 2;

                        cookies -= clickUpPrice;

                        clickUpPrice \*= 10;

                    }

            }

            if (cursors >= 1) {

                //the box around the cursor upgrade icon

                fill(117, 61, 6);

                stroke(26, 18, 0);

                strokeWeight(4);

                rect(crsrUpX - 10, clickY, 84, 101);

                //the cursor upgrade icon

                drawCrsr(crsrUpX + 30, clickY + 55, 44, 232, 242);

                if (mouseX >= crsrUpHBX1 && mouseX <= crsrUpHBX2 && mouseY >= crsrUpHBY1 && mouseY <= crsrUpHBY2) {

                    //info about the upgrade

                    fill(117, 61, 6);

                    stroke(26, 18, 0);

                    strokeWeight(4);

                    rect(crsrUpX - 10, clickY - 96, 84, 93);

                    fill(255, 255, 255);

                    text("Cursor upgrade", crsrUpX - 10, clickY - 88);

                    text("Cursor upgrade", crsrUpX - 10, clickY - 88);

                    text("This makes \ncursors 2X \nas effective.", crsrUpX - 10, clickY - 72.5);

                    text(crsrUpPrice + "\ncookies to buy", crsrUpX - 10, clickY - 23.3);

                    if (cookies >= crsrUpPrice && mouseIsPressed) {

                        crsrLvl \*= 2;

                        cookies -= crsrUpPrice;

                        crsrUpPrice \*= 10;

                    }

                }

            }

};

And now for version 0.00054. /\*

            this effect doesn't work properly on mobile devices, sorry mobile players:

              \_\_\_\_\_\_\_

             /       \

             \\_\_\_\_\_\_\_/

        \_\_     \_\_\_           \_\_

       |\_\_   /     \   | /  |\_\_

        \_\_   \_\_\_    \_\_\_         \_\_ \_\_    \_\_

        \_\_         \_\_ \_\_   \_\_          \_\_    \_\_

    A JAYDAR STUDIOS GAME

    FAKE COOKIE CLICKER DEFINITIVE EDITION, COPYRIGHT 2022, JAYDAR STUDIOS, INC.

	* /

/\*\*

    PATCH NOTES:

        V0.00054 (Gigantamax Evolve-able Grandmas): I added an upgrade for the Grandma.

        V0.000532 (Futureproofing Update): As I'm worried of not being able to see all of the achievements, a way to see them all was added, for futureproofing.

        V0.000531 (Summer(-ish) Cleaning Update): Cleaned up a bit of code, more specifically, adding some sub-objects into the GameFunctions object, moving some functions into the same object, and making the first ever officially-named update! (also edited the patch notes for the previous update.)

        V0.00053: Added some cheats, and the first ever Shadow Achievement (hint: try a 'le hack'.)

        V0.000522: Added a couple achievements.

        V0.000521: Fixed a bug with the cursor.

        V0.00052: Added a lot more achievements (more specifically 5), along with a bit more clarification to the "Achievs" object.

        V0.000513: Added a "Speedrunner's Guide".

        V0.000512: Fixed a bug with the "Won't Budge" achievement where you could get it multiple times and fixed a bug where you might not get cookie achievements if you ran the game in the background.

        V0.000511: Fixed an extremely small bug with the "Can We Fix It?" Achievement.

        V0.00051: Fixed the Grandma (in multiple ways).

        V0.0005: Added Grandma and an extra Achieveeement.

        V0.00045: Added acheivements.

        V0.00044: Added upgrades for cursors.

        V0.00043: Added the fist upgrade of many to come, that upgrade being an upgrade to the cookie clicks.

        V0.000421: Added graphics for a prototype upgrade for cookie clicks

        V0.00042: Added the info board (kinda)

        V0.00041: Made cursors appear underneath the big cookie

        V0.0004: FINALLY FINISHED THE CURSOR (kinda, I need to add it underneath the cookie and add info when the buy icon is hovered over, but still!)

        V0.00031: Added more graphics for when I actually implement the cursor and changed to a version number rather than a prototype number

        V0.00030 (prototype 3): Tried to do more work, ended up doing about nothing

        V0.00025 (prototype 2.5): Added a rectangle

        V0.00020 (prototype 2): Finished the chips

        V0.00010 (prototype 1): Original prototype release

	* /

/\*

    To do (most important to least important):

    Add saving

    Fix the big cookie's hitbox to make it a circle

    Add SFX

    Once the info board is added, I need to make sure the cookie count text doesn't overlap with the info board.

    Add the news ticker

    Add particles

    Add bulk buying

    Add debug features

    Maybe create a seperate website for this game????? (I'm kinda limited in Khan Academy)

	* /

/\*

    DONE (oldest to latest):

    Finish the Cursor

    Add the info board (sorta)

    Added an upgrade for clicking the cookie! (HERE COMES THE HYPE TRAIN!!!!!!!!!!!!!!)

    Added an upgrade for the cursor (THOMAS THE HYPE TRAIN LEVELS OF HYPE)

	* /

/\*\*

    And now, the offical speedrunner's guide to DE speedruns, made by Jaydar:

        SPEEDRUN CATEGORIES:

    10K cookies (earn 10 thousand cookies all-time w/o messing with the code.)

    1M cookies (earn 1 million cookies all-time w/o messing with the code.)

    All Achievements (Earn every achievement in the game w/o messing with the code.)

        SUBCATEGORIES:

    Any% (beating that category in any way, while still obeying the main category's rules)

    Low click% (beating that category while clicking the cookie the least amount of times)

        CATEGORY EXSTENSIONS:

    ACE (Messing with the game's code to get to 1 Million cookies. Cookie clicks are NOT ALLOWED!)

    short% (An extremely short run where you have to get these achievements: "Bakeginner", "Nice try", and "Won't Budge!")

    timetravel% (A run where you have to get 10 cookies in every version of the game.)

    That's it; enjoy running these categories soon!

    NOTE: Speedrun leaderboards on speedrun.com aren't ready yet, but you can still record speedruns in advance.

	* + /

/\*\*

        FEATURES:

    - A big cookie

    - Buyable Cursors and Grandmas

    - Upgrades

    - Stats

    - Achievements

    - Cookies

    - And soon enough, speedrun.com leaderboards(?)! (The future for speedrun leaderboards are uncertain right now.)

/\*\*

                CREDITS:

Cookie clicker is by Orteil, I have his thanks for this project, as it's his concept.

Fake Cookie clicker and Fake Cookie Clicker: Definitive Edition by me, copyright 2021 - 2022.

Code is by me, unless I say "This code is by (so and so)."

Graphics are by me.

	* /

//enough boring stuff, here comes the code:

//this sets the fps cap to 30 (like in OG cookie clicker)

var fpsCap = 30;

//variables for the cookie's location

var cookieSize = 135;

var cookieX = 70;

var cookieY = 300;

    //variables for the cookie's (currently slightly janky) hitbox

    var cookieHitboxX1 = cookieX - 45;

    var cookieHitboxX2 = cookieHitboxX1 + cookieSize;

    var cookieHitboxY1 = cookieY - (cookieSize / 2);

    var cookieHitboxY2 = cookieY + (cookieSize / 2);

    //cookie count setup

    var cookies = 0;

    //all time cookies setup

    var allTimeCookies = 0;

    //cookies per second setup

    var CpS = 0;

    //variables for the chips

    var chipX = 30;

    var chipY = 35;

    var chipRad = 120;

//variables for the building buy icon

var buyX = 395;

var buyY = 265;

var buyW = 205;

var buyH = 75;

//variables for the cursor

var cursors = 0;

var cursorPrice = 15 + (cursors \* 2);

//variables for the building buy icon's hitbox

var buyHBX1 = buyX;

var buyHBX2 = buyHBX1 + buyW;

var buyHBY1 = buyY;

var buyHBY2 = buyHBY1 + buyH;

//buy things font

var font1 = createFont("monospace", 18);

//cookie count font

var font2 = createFont("sans-serif", 10);

//this function draws the cursor

var drawCrsr = function(crsrX, crsrY, crsrHue1, crsrHue2, crsrHue3) {

    strokeWeight(1);

    fill(crsrHue1, crsrHue2, crsrHue3);

    //base of the cursor

    ellipse(crsrX, crsrY, 72, 45);

    //the fingers (YES I KNOW THERE'S ONLY 4 FINGERS I'M JUST TOO LAZY TO ADD ANOTHER)

    rect((crsrX + 13) - 45, (crsrY + 48) - (45 \* 2), 20, 32);

    rect((crsrX + 33) - 45, (crsrY + 39) - (45 \* 2), 20, 32);

    rect((crsrX + 51) - 45, (crsrY + 45) - (45 \* 2), 20, 32);

    rect((crsrX + 65) - 45, (crsrY + 53) - (45 \* 2), 20, 32);

};

//Timer for the cursor

var CrsrTime = 0;

//grandma stuff

//pos

var buy2Y = buyY + 75;

//price

var gMaPrice = 100;

//# owned

var gMas = 0;

//draw grandma

var drawGMa = function(gMaX, gMaY, gMaH1, gMaH2, gMaH3) {

    fill(gMaH1, gMaH2, gMaH3);

    ellipse(gMaX, gMaY, 65, 65);

    fill(191, 242, 239);

    ellipse(gMaX - 13, gMaY - 11.5, 15, 15);

    ellipse(gMaX + 13, gMaY - 11.5, 15, 15);

    fill(0, 0, 0);

    arc(gMaX, gMaY - 10, 15, 0, 0, 180);

};

//hitboxes

var buy2HBX1 = buyX;

var buy2HBX2 = buyX + buyW;

var buy2HBY1 = buy2Y;

var buy2HBY2 = buy2Y + buyH;

var gmaTime = 0;

//Tracks the upgrade level of clicking the cookie

var clickLvl = 1;

//tracks the price of the click upgrade

var clickUpPrice = 100;

//Tracks the pos of the click upgrade's triangle

var clickX = 424;

var clickY = 97;

//tracks the upgrade level of the cursor

var crsrLvl = 1;

//variables for the click upgrade's hitbox

var clickUpHBX1 = clickX - 25;

var clickUpHBX2 = clickUpHBX1 + 72;

var clickUpHBY1 = clickY - 10;

var clickUpHBY2 = clickUpHBY1 + 101;

//tracks the price of the cursor uprade

var crsrUpPrice = 250;

//tracks the x pos of the cursor upgrade

var crsrUpX = clickX + 51;

//variables for the cursor upgrade hitbox

var crsrUpHBX1 = crsrUpX;

var crsrUpHBX2 = crsrUpHBX1 + 84;

var crsrUpHBY1 = clickY;

var crsrUpHBY2 = crsrUpHBY1 + 101;

//tracks the upgrade level of the grandma

var gmaLvl = 1;

var gmaUpX = clickX - 25;

var gmaUpY = clickY + 420;

//grandma upgrade hitbox

var gmaUpHBX1 = gmaUpX;

var gmaUpHBX2 = gmaUpHBX1 + 79;

var gmaUpHBY1 = gmaUpY;

var gmaUpHBY2 = gmaUpHBY1 + 81;

var gmaUpPrice = 500;

//Building count

var buildings = 0;

//Achievement handling (part 1)

//array that displays Achievements on the stats screen, as names and requirements are added to the array.

var Achieves = [];

//an object that stores Achievements. I abbreviated the names in the code, but I'll use comments to display the achievement's actual name for you fellow nosy nerds. (You're welcome, by the way!)

var Achieved = {

    consPrize: "false", // This is for "Consolation Prize"

    bakeginner: "false", // This is for "Bakeginner"

    overnine: "false", // This is for "It's over NINE!"

    approach: "false", // This is for "Oh? You're approaching my cookies?"

    rollDough: "false", // This is for "Rolling In The DOUGH"

    toFeed: "false", // This is for "Enough To Feed A Highschool"

    fixIt: "false", // This is for "Can We Fix It?"

    squeakSqueak: "false", // This is for "Squeak, Squeak"

    muchClick: "false",

    okBoomer: "false", // This is for "Ok Boomer"

    famBuis: "false",

    nicetry: "false", // This is for "Nice Try"

    wontbudge: "false", // This is for "Won't Budge"

    rotDough: "false"

};

//This one is full of cheats and other misc. functions for screwing around.

var gameFunctions = {

    inGameStuff: {

        Rot\_The\_Dough: function(ruinTxt) {

            if (Achieved.rotDough === "false") {

                Achieved.rotDough = "true";

                var sndPly = function() {

                    var snd2 = getSound("retro/coin");

                    snd2.audio.volume = 1;

                    snd2.audio.preservesPitch = false;

                    snd2.audio.playbackRate = 0.5;

                    playSound(snd2);

                };

                sndPly();

                Achieves.push("\nRotten Dough (Shadow Achievement)");

            }

            if (ruinTxt === true) {

                println("Great job, you frickin idiot. You ruined any and all fun you could've had.\nFor your dastardly deeds, take this special Shadow Achievement as a badge that will \nwarn everyone to stay away from you. \nSorry, I got off on a tangent there. I'm just saying, you're missing out. \nAnyways, I gotta go. Once again, sorry for the tangent. Keep on clicking, and enjoy this stupid game! - Jaydar");

            }

        },

        //this just plays the SFX for Achievements

        playChiev: function() {

            var snd = getSound("retro/coin");

            snd.audio.volume = 0.095;

            snd.audio.playbackRate = 1;

            playSound(snd);

        },

        //This unlocks "Nice Try!"

        unlocknicetry: function() {

            Achieved.nicetry = "true";

            Achieves.push("\nNice Try (Right-click the cookie)");

            gameFunctions.inGameStuff.playChiev();

        },

        //This function unlocks "Won't Budge!"

        unlockwontbudge: function() {

            Achieved.wontbudge = "true";

            Achieves.push("\nWon't budge! (Middle-click the cookie after right-clicki\n-ng it)");

            gameFunctions.inGameStuff.playChiev();

        }

    },

    properCheats: {

        Spill\_The\_Milk: function() {

            cursors += 500000000;

            gMas += 50000000;

            cookies = 9999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999;

            gameFunctions.inGameStuff.Rot\_The\_Dough(true);

            allTimeCookies = cookies;

        }

    },

    other: {

        Blast\_To\_The\_Past: function() {

            Program.restart();

        }

    }

};

//where the true magic happens

var draw = function() {

    strokeWeight(1);

    stroke(0, 0, 0);

    background(120, 194, 255);

    frameRate(30);

     if (mouseIsPressed && mouseX > cookieHitboxX1 && mouseX < cookieHitboxX2 && mouseY > cookieHitboxY1 && mouseY < cookieHitboxY2 && mouseButton === LEFT){ //detects when you click on the cookie's hitbox

        cookieSize = 75; // makes the cookie smaller

        //changing stuff with the chips

        chipRad = 65;

        chipX = 18;

        chipY = 26;

    } else {

        cookieSize = 135; //makes the cookie its normal size

        //setting stuff with the chips to normal

        chipRad = 120;

        chipX = 30;

        chipY = 35;

    }

    //buy icon

    fill(61, 155, 255);

    rect(buyX, buyY, 204, buyH);

    fill(255, 255, 255);

    //price text

    textFont(font1);

    text(cursorPrice + " Cookies", buyX + 15, buyY + 65);

    //title for the buy icon

    textFont(font1);

    text("Cursor", buyX + 31, buyY + 14.3);

    //cursor count text

    textSize(28);

    text(cursors, buyX + 9, buyY + 36);

    //calls the function to draw the cursor (see way earlier in the code)

    drawCrsr(550, 315, 255, 255, 255);

    fill(61, 155, 255);

    rect(buyX, buy2Y, 204, buyH);

    fill(255, 255, 255);

    //price text

    textFont(font1);

    text(gMaPrice + " Cookies", buyX + 15, buy2Y + 65);

    //title for the buy icon

    textFont(font1);

    text("Grandma", buyX + 31, buy2Y + 14.3);

    //cursor count text

    textSize(28);

    text(gMas, buyX + 9, buy2Y + 36);

    //calls the function to draw grandma

    drawGMa(550, 380, 255, 0, 239);

    //shhhhhhhhhhh don't look or change, it's debug text

    fill(130, 193, 255);

    text(CrsrTime, 200, 200);

    //cookie count text

    fill(255, 255, 255);

    textFont(font2);

    textAlign(CENTER);

    text("Cookies: " + cookies, cookieX, 45);

    //nothing special

    textAlign(LEFT);

    //sets the framerate to the fps cap

    frameRate(fpsCap);

    //draws the cursors below the big cookie

    var crsrY2 = 417;

    for (var rep = 0; rep < cursors && rep < 5; rep++) {

        drawCrsr(cookieX, crsrY2, 255, 255, 255);

        crsrY2 += 75;

    }

    //the base of the cookie

    fill(173, 151, 26);

    ellipse(cookieX, cookieY, cookieSize, cookieSize);

    //sets the CpS

    CpS = ((round(cursors \* crsrLvl) / 10) + gMas);

    //the chips in the cookie

    fill(135, 76, 10);

    ellipse(cookieX - chipX, cookieY - chipY, cookieSize - chipRad, cookieSize - chipRad);

    ellipse(cookieX, cookieY, cookieSize - (chipRad - 21), cookieSize - (chipRad - 21));

    ellipse(cookieX + chipX, cookieY - 25, cookieSize - (chipRad - 4.25), cookieSize - (chipRad - 4.25));

        //how cookies are gained

        mouseClicked = function(){

        if (mouseX > cookieHitboxX1 && mouseX < cookieHitboxX2 && mouseY > cookieHitboxY1 && mouseY < cookieHitboxY2 && mouseButton === LEFT){

            cookies += 1 \* clickLvl;

            allTimeCookies += 1 \* clickLvl;

        } else if(mouseX > cookieHitboxX1 && mouseX < cookieHitboxX2 && mouseY > cookieHitboxY1 && mouseY < cookieHitboxY2 && mouseButton === RIGHT && Achieved.nicetry === "false"){ //"Nice Try" Achieveement

                gameFunctions.inGameStuff.unlocknicetry();

        } else if(mouseX > cookieHitboxX1 && mouseX < cookieHitboxX2 && mouseY > cookieHitboxY1 && mouseY < cookieHitboxY2 && mouseButton === CENTER && Achieved.nicetry === "true" && Achieved.wontbudge === "false") { //"Won't Budge!" Achieveement

                gameFunctions.inGameStuff.unlockwontbudge();

            //how cursors are gained

            } else if (mouseX > buyHBX1 && mouseX < buyHBX2 && mouseY > buyHBY1 && mouseY < buyHBY2 && cookies >= cursorPrice){

                cursors += 1;

                cookies -= cursorPrice; //takes away cookies

                cursorPrice = 15 + (cursors \* 2); //changes the price

                buildings += 1;

            } else if (mouseX > buy2HBX1 && mouseX < buy2HBX2 && mouseY > buy2HBY1 && mouseY < buy2HBY2 && cookies >= gMaPrice) {

                gMas += 1;

                cookies -= gMaPrice;

                gMaPrice = 100 + (gMas \* 15);

                buildings += 1;

            }

        };

            //grandma timer

            if (gmaTime >= 1) {

                if (gMas >= 1) {

                    cookies += 1;

                    allTimeCookies += 1;

                }

                gmaTime = 0;

            } else {

                gmaTime += 0.04 \* gMas;

            }

            //the timer for the cursor I worked so hard on (this is the main reason I'm making my own site)

            if (CrsrTime >= (10 / cursors)){

                if (cursors >= 1){

                    cookies += crsrLvl;

                    allTimeCookies += crsrLvl;

                }

                CrsrTime = 0;

            } else {

                CrsrTime += (1 / fpsCap);

            }

            //stats screen

            //acheivement handler (part 2, go back to somewhere near line 210 for part 1)

        //Cookie Achievements

            if (allTimeCookies >= 1 && Achieved.bakeginner === "false") {

                Achieved.bakeginner = "true";

                Achieves.push("\nBakeginner (bake 1 cookie)");

                gameFunctions.inGameStuff.playChiev();

            } else if (allTimeCookies >= 10 && Achieved.overnine === "false") {

                Achieved.overnine = "true";

                Achieves.push("\nIt's Over NINE! (bake 10 cookies)");

                gameFunctions.inGameStuff.playChiev();

            } else if (allTimeCookies >= 100 && Achieved.rollDough === "false") {

                Achieved.rollDough = "true";

                Achieves.push("\nRolling In the DOUGH (bake 100 cookies)");

                gameFunctions.inGameStuff.playChiev();

            } else if (allTimeCookies >= 1000 && Achieved.approach === "false") {

                Achieved.approach = "true";

                Achieves.push("\nOh? You're approaching my cookies? (bake 1,000 c\n-ookies)");

                gameFunctions.inGameStuff.playChiev();

            } else if (allTimeCookies >= 10000 && Achieved.toFeed === "false") {

                Achieved.toFeed = "true";

                Achieves.push("\nEnough to feed a highschool (bake 10,000 cookies)");

                gameFunctions.inGameStuff.playChiev();

        //Building Achievements

            } else if (buildings >= 1 && Achieved.fixIt === "false") {

                Achieved.fixIt = "true";

                Achieves.push("\nCan We Fix It? (Purchase a building)");

                gameFunctions.inGameStuff.playChiev();

            } else if (cursors >= 1 && Achieved.squeakSqueak === "false") {

                Achieved.squeakSqueak = "true";

                Achieves.push("\nSqueak, Squeak (purchase 1 cursor)");

                gameFunctions.inGameStuff.playChiev();

            } else if (cursors >= 10 && Achieved.muchClick === "false") {

                Achieved.muchClick = "true";

                Achieves.push("\nMuch click. So wow. (Own 10 cursors)");

                gameFunctions.inGameStuff.playChiev();

            } else if (gMas >= 1 && Achieved.okBoomer === "false") {

                Achieved.okBoomer = "true";

                Achieves.push("\nOk Boomer (Purchase 1 grandma)");

                gameFunctions.inGameStuff.playChiev();

            } else if (gMas >= 10 && Achieved.famBuis === "false") {

                Achieved.famBuis = "true";

                Achieves.push("\nFamily Buisness (Own 10 grandmas)");

                gameFunctions.inGameStuff.playChiev();

            } else if (millis() >= 1 && Achieved.consPrize === "false") {

                Achieved.consPrize = "true";

                Achieves.push("\nConsolation Prize (Boot up this game)");

                gameFunctions.inGameStuff.playChiev();

            }

            if (keyIsPressed && key.code === 32) {

                println("---\nALL ACHIEVEMENTS:\n" + Achieves + "\n---");

            }

            strokeWeight(3);

            var statX = 140;

            var statY = 1;

            fill(179, 118, 6);

            rect(statX, statY, 255, height - 1);

            fill(255, 255, 255);

            //title

            textSize(25);

            text("Stats", statX + 30, statY + 30);

            //actual stats text

            textSize(10);

            text(cookies + " cookie(s) in bank", statX + 10, statY + 72); //cookies in bank

            text(allTimeCookies + " cookie(s) baked (all time)", statX + 10, statY + 97); //all time cookie(s)

            text("CpS: " + CpS, statX + 10, statY + 118);  //CpS

            text("Buildings: " + buildings, statX + 10, statY + 139); //buildings

            text("Achievements (" + Achieves.length + "/" + (Object.keys(Achieved).length - 1) + ") (Press space to see all): " + Achieves, statX + 10, statY + 160); //I use all of these .length functions so that I can easily track how many Achievements you have to how many total are in the game. Also thanks to KA user "Kopter Coding" for the help with the total achievement count (with the Object.keys() part.)

            //cookie click upgrade icon code

            //the box around the upgrade's icon

            fill(117, 61, 6);

            stroke(26, 18, 0);

            strokeWeight(4);

            rect(clickX - 25, clickY, 53, 101);

            //the upgrade's actual icon

            strokeWeight(1);

            stroke(0, 0, 0);

            fill(44, 232, 242);

            rect(clickX - 10, clickY + 55, 25, 35);

            triangle(clickX - 10, clickY + 10, clickX - 10, clickY + 68, clickX + 16, clickY + 58);

            if (mouseX >= clickUpHBX1 && mouseX <= clickUpHBX2 - 15 && mouseY >= clickUpHBY1 && mouseY <= clickUpHBY2) {

                //info about the upgrade

                fill(117, 61, 6);

                stroke(26, 18, 0);

                strokeWeight(4);

                rect(clickX - 27, clickY - 96, 75, 93);

                fill(255, 255, 255);

                text("Clicking upgrade", clickX - 25, clickY - 88);

                text("Clicking upgrade", clickX - 25, clickY - 88);

                text("This makes click\n-ing the cookie\n2X as effective.", clickX - 25, clickY - 72.5);

                text(clickUpPrice + "\ncookies to buy", clickX - 25, clickY - 23.3);

                    if (cookies >= clickUpPrice && mouseIsPressed) {

                        clickLvl \*= 2;

                        cookies -= clickUpPrice;

                        clickUpPrice \*= 10;

                    }

            }

            if (cursors >= 1) {

                //the box around the cursor upgrade icon

                fill(117, 61, 6);

                stroke(26, 18, 0);

                strokeWeight(4);

                rect(crsrUpX - 10, clickY, 84, 101);

                //the cursor upgrade icon

                drawCrsr(crsrUpX + 30, clickY + 55, 44, 232, 242);

                if (mouseX >= crsrUpHBX1 && mouseX <= crsrUpHBX2 && mouseY >= crsrUpHBY1 && mouseY <= crsrUpHBY2) {

                    //info about the upgrade

                    fill(117, 61, 6);

                    stroke(26, 18, 0);

                    strokeWeight(4);

                    rect(crsrUpX - 10, clickY - 96, 84, 93);

                    fill(255, 255, 255);

                    text("Cursor upgrade", crsrUpX - 10, clickY - 88);

                    text("Cursor upgrade", crsrUpX - 10, clickY - 88);

                    text("This makes \ncursors 2X \nas effective.", crsrUpX - 10, clickY - 72.5);

                    text(crsrUpPrice + "\ncookies to buy", crsrUpX - 10, clickY - 23.3);

                    if (cookies >= crsrUpPrice && mouseIsPressed) {

                        crsrLvl \*= 2;

                        cookies -= crsrUpPrice;

                        crsrUpPrice \*= 10;

                    }

                }

            }

            if (gMas >= 1) {

                fill(117, 61, 6);

                stroke(26, 18, 0);

                strokeWeight(4);

                rect(gmaUpX, gmaUpY, 79, 81);

                strokeWeight(1);

                drawGMa(clickX + 15, clickY + 460, 44, 232, 242);

                if (mouseX >= gmaUpHBX1 && mouseX <= gmaUpHBX2 && mouseY >= gmaUpHBY1 && mouseY <= gmaUpHBY2) {

                    //info about the upgrade

                    fill(117, 61, 6);

                    stroke(26, 18, 0);

                    strokeWeight(4);

                    rect(gmaUpX, gmaUpY - 98, 84, 93);

                    fill(255, 255, 255);

                    text("Grandma upgrade", gmaUpX, gmaUpY - 88);

                    text("Grandma upgrade", gmaUpX, gmaUpY - 88);

                    text("This makes \ngrandmas 2X \nas effective.", gmaUpX, gmaUpY - 72.5);

                    text(gmaUpPrice + "\ncookies to buy", gmaUpX, gmaUpY - 23.3);

                    if (cookies >= gmaUpPrice && mouseIsPressed) {

                        gmaLvl \*= 2;

                        cookies -= gmaUpPrice;

                        gmaUpPrice \*= 10;

                    }

                }

            }

};

Now for version 0.000542

/\*

            this effect doesn't work properly on mobile devices, sorry mobile players:

              \_\_\_\_\_\_\_

             /       \

             \\_\_\_\_\_\_\_/

        \_\_     \_\_\_           \_\_

       |\_\_   /     \   | /  |\_\_

        \_\_   \_\_\_    \_\_\_         \_\_ \_\_    \_\_

        \_\_         \_\_ \_\_   \_\_          \_\_    \_\_

    A JAYDAR STUDIOS GAME

    FAKE COOKIE CLICKER DEFINITIVE EDITION, COPYRIGHT 2022, JAYDAR STUDIOS, INC.

	* /

/\*\*

    PATCH NOTES:

        V0.000542 (And all that glitters looks old): Changed the default color of the Grandma, and fixed a minor bug where grandma upgrades didn't affect your CpS in the Stats page.

        V0.000541 (Gigantamax Fix): Fixed the Grandma Upgrade.

        V0.00054 (Gigantamax Evolve-able Grandmas): I added an upgrade for the Grandma.

        V0.000532 (Futureproofing Update): As I'm worried of not being able to see all of the achievements, a way to see them all was added, for futureproofing.

        V0.000531 (Summer(-ish) Cleaning Update): Cleaned up a bit of code, more specifically, adding some sub-objects into the GameFunctions object, moving some functions into the same object, and making the first ever officially-named update! (also edited the patch notes for the previous update.)

        V0.00053: Added some cheats, and the first ever Shadow Achievement (hint: try a 'le hack'.)

        V0.000522: Added a couple achievements.

        V0.000521: Fixed a bug with the cursor.

        V0.00052: Added a lot more achievements (more specifically 5), along with a bit more clarification to the "Achievs" object.

        V0.000513: Added a "Speedrunner's Guide".

        V0.000512: Fixed a bug with the "Won't Budge" achievement where you could get it multiple times and fixed a bug where you might not get cookie achievements if you ran the game in the background.

        V0.000511: Fixed an extremely small bug with the "Can We Fix It?" Achievement.

        V0.00051: Fixed the Grandma (in multiple ways).

        V0.0005: Added Grandma and an extra Achieveeement.

        V0.00045: Added acheivements.

        V0.00044: Added upgrades for cursors.

        V0.00043: Added the fist upgrade of many to come, that upgrade being an upgrade to the cookie clicks.

        V0.000421: Added graphics for a prototype upgrade for cookie clicks

        V0.00042: Added the info board (kinda)

        V0.00041: Made cursors appear underneath the big cookie

        V0.0004: FINALLY FINISHED THE CURSOR (kinda, I need to add it underneath the cookie and add info when the buy icon is hovered over, but still!)

        V0.00031: Added more graphics for when I actually implement the cursor and changed to a version number rather than a prototype number

        V0.00030 (prototype 3): Tried to do more work, ended up doing about nothing

        V0.00025 (prototype 2.5): Added a rectangle

        V0.00020 (prototype 2): Finished the chips

        V0.00010 (prototype 1): Original prototype release

	* /

/\*

    To do (most important to least important):

    Add saving

    Fix the big cookie's hitbox to make it a circle

    Add SFX

    Once the info board is added, I need to make sure the cookie count text doesn't overlap with the info board.

    Add the news ticker

    Add particles

    Add bulk buying

    Add debug features

    Maybe create a seperate website for this game????? (I'm kinda limited in Khan Academy)

	* /

/\*

    DONE (oldest to latest):

    Finish the Cursor

    Add the info board (sorta)

    Added an upgrade for clicking the cookie! (HERE COMES THE HYPE TRAIN!!!!!!!!!!!!!!)

    Added an upgrade for the cursor (THOMAS THE HYPE TRAIN LEVELS OF HYPE)

	* /

/\*\*

    And now, the offical speedrunner's guide to DE speedruns, made by Jaydar:

        SPEEDRUN CATEGORIES:

    10K cookies (earn 10 thousand cookies all-time w/o messing with the code.)

    1M cookies (earn 1 million cookies all-time w/o messing with the code.)

    All Achievements (Earn every achievement in the game w/o messing with the code.)

        SUBCATEGORIES:

    Any% (beating that category in any way, while still obeying the main category's rules)

    Low click% (beating that category while clicking the cookie the least amount of times)

        CATEGORY EXSTENSIONS:

    ACE (Messing with the game's code to get to 1 Million cookies. Cookie clicks are NOT ALLOWED!)

    short% (An extremely short run where you have to get these achievements: "Bakeginner", "Nice try", and "Won't Budge!")

    timetravel% (A run where you have to get 10 cookies in every version of the game.)

    That's it; enjoy running these categories soon!

    NOTE: Speedrun leaderboards on speedrun.com aren't ready yet, but you can still record speedruns in advance.

	* + /

/\*\*

        FEATURES:

    - A big cookie

    - Buyable Cursors and Grandmas

    - Upgrades

    - Stats

    - Achievements

    - Cookies

    - And soon enough, speedrun.com leaderboards(?)! (The future for speedrun leaderboards are uncertain right now.)

/\*\*

                CREDITS:

Cookie clicker is by Orteil, I have his thanks for this project, as it's his concept.

Fake Cookie clicker and Fake Cookie Clicker: Definitive Edition by me, copyright 2021 - 2022.

Code is by me, unless I say "This code is by (so and so)."

Graphics are by me.

	* /

//enough boring stuff, here comes the code:

//this sets the fps cap to 30 (like in OG cookie clicker)

var fpsCap = 30;

//variables for the cookie's location

var cookieSize = 135;

var cookieX = 70;

var cookieY = 300;

    //variables for the cookie's (currently slightly janky) hitbox

    var cookieHitboxX1 = cookieX - 45;

    var cookieHitboxX2 = cookieHitboxX1 + cookieSize;

    var cookieHitboxY1 = cookieY - (cookieSize / 2);

    var cookieHitboxY2 = cookieY + (cookieSize / 2);

    //cookie count setup

    var cookies = 0;

    //all time cookies setup

    var allTimeCookies = 0;

    //cookies per second setup

    var CpS = 0;

    //variables for the chips

    var chipX = 30;

    var chipY = 35;

    var chipRad = 120;

//variables for the building buy icon

var buyX = 395;

var buyY = 265;

var buyW = 205;

var buyH = 75;

//variables for the cursor

var cursors = 0;

var cursorPrice = 15 + (cursors \* 2);

//variables for the building buy icon's hitbox

var buyHBX1 = buyX;

var buyHBX2 = buyHBX1 + buyW;

var buyHBY1 = buyY;

var buyHBY2 = buyHBY1 + buyH;

//buy things font

var font1 = createFont("monospace", 18);

//cookie count font

var font2 = createFont("sans-serif", 10);

//this function draws the cursor

var drawCrsr = function(crsrX, crsrY, crsrHue1, crsrHue2, crsrHue3) {

    strokeWeight(1);

    fill(crsrHue1, crsrHue2, crsrHue3);

    //base of the cursor

    ellipse(crsrX, crsrY, 72, 45);

    //the fingers (YES I KNOW THERE'S ONLY 4 FINGERS I'M JUST TOO LAZY TO ADD ANOTHER)

    rect((crsrX + 13) - 45, (crsrY + 48) - (45 \* 2), 20, 32);

    rect((crsrX + 33) - 45, (crsrY + 39) - (45 \* 2), 20, 32);

    rect((crsrX + 51) - 45, (crsrY + 45) - (45 \* 2), 20, 32);

    rect((crsrX + 65) - 45, (crsrY + 53) - (45 \* 2), 20, 32);

};

//Timer for the cursor

var CrsrTime = 0;

//grandma stuff

//pos

var buy2Y = buyY + 75;

//price

var gMaPrice = 100;

//# owned

var gMas = 0;

//draw grandma (credits to FANDOM wiki user and fellow admin, A2A2tgt)

var drawGMa = function(gMaX, gMaY, hueChange, gMaH1, gMaH2, gMaH3) {

    if (hueChange === false) {

        fill(214, 160, 160);

    } else {

        fill(gMaH1, gMaH2, gMaH3);

    }

    ellipse(gMaX, gMaY, 65, 65);

    fill(235, 129, 171);

    ellipse(gMaX, gMaY + 15, 25, 5);

    fill(191, 242, 239);

    ellipse(gMaX - 13, gMaY - 11.5, 15, 15);

    ellipse(gMaX + 13, gMaY - 11.5, 15, 15);

    fill(0, 0, 0);

    arc(gMaX, gMaY - 10, 15, 0, 0, 180);

};

//hitboxes

var buy2HBX1 = buyX;

var buy2HBX2 = buyX + buyW;

var buy2HBY1 = buy2Y;

var buy2HBY2 = buy2Y + buyH;

var gmaTime = 0;

//Tracks the upgrade level of clicking the cookie

var clickLvl = 1;

//tracks the price of the click upgrade

var clickUpPrice = 100;

//Tracks the pos of the click upgrade's triangle

var clickX = 424;

var clickY = 97;

//tracks the upgrade level of the cursor

var crsrLvl = 1;

//variables for the click upgrade's hitbox

var clickUpHBX1 = clickX - 25;

var clickUpHBX2 = clickUpHBX1 + 72;

var clickUpHBY1 = clickY - 10;

var clickUpHBY2 = clickUpHBY1 + 101;

//tracks the price of the cursor uprade

var crsrUpPrice = 250;

//tracks the x pos of the cursor upgrade

var crsrUpX = clickX + 51;

//variables for the cursor upgrade hitbox

var crsrUpHBX1 = crsrUpX;

var crsrUpHBX2 = crsrUpHBX1 + 84;

var crsrUpHBY1 = clickY;

var crsrUpHBY2 = crsrUpHBY1 + 101;

//tracks the upgrade level of the grandma

var gmaLvl = 1;

var gmaUpX = clickX - 25;

var gmaUpY = clickY + 420;

//grandma upgrade hitbox

var gmaUpHBX1 = gmaUpX;

var gmaUpHBX2 = gmaUpHBX1 + 79;

var gmaUpHBY1 = gmaUpY;

var gmaUpHBY2 = gmaUpHBY1 + 81;

var gmaUpPrice = 500;

//Building count

var buildings = 0;

//Achievement handling (part 1)

//array that displays Achievements on the stats screen, as names and requirements are added to the array.

var Achieves = [];

//an object that stores Achievements. I abbreviated the names in the code, but I'll use comments to display the achievement's actual name for you fellow nosy nerds. (You're welcome, by the way!)

var Achieved = {

    consPrize: "false", // This is for "Consolation Prize"

    bakeginner: "false", // This is for "Bakeginner"

    overnine: "false", // This is for "It's over NINE!"

    approach: "false", // This is for "Oh? You're approaching my cookies?"

    rollDough: "false", // This is for "Rolling In The DOUGH"

    toFeed: "false", // This is for "Enough To Feed A Highschool"

    fixIt: "false", // This is for "Can We Fix It?"

    squeakSqueak: "false", // This is for "Squeak, Squeak"

    muchClick: "false",

    okBoomer: "false", // This is for "Ok Boomer"

    famBuis: "false",

    nicetry: "false", // This is for "Nice Try"

    wontbudge: "false", // This is for "Won't Budge"

    rotDough: "false"

};

//This one is full of cheats and other misc. functions for screwing around.

var gameFunctions = {

    inGameStuff: {

        Rot\_The\_Dough: function(ruinTxt) {

            if (Achieved.rotDough === "false") {

                Achieved.rotDough = "true";

                var sndPly = function() {

                    var snd2 = getSound("retro/coin");

                    snd2.audio.volume = 1;

                    snd2.audio.preservesPitch = false;

                    snd2.audio.playbackRate = 0.5;

                    playSound(snd2);

                };

                sndPly();

                Achieves.push("\nRotten Dough (Shadow Achievement)");

            }

            if (ruinTxt === true) {

                println("Great job, you frickin idiot. You ruined any and all fun you could've had.\nFor your dastardly deeds, take this special Shadow Achievement as a badge that will \nwarn everyone to stay away from you. \nSorry, I got off on a tangent there. I'm just saying, you're missing out. \nAnyways, I gotta go. Once again, sorry for the tangent. Keep on clicking, and enjoy this stupid game! - Jaydar");

            }

        },

        //this just plays the SFX for Achievements

        playChiev: function() {

            var snd = getSound("retro/coin");

            snd.audio.volume = 0.095;

            snd.audio.playbackRate = 1;

            playSound(snd);

        },

        //This unlocks "Nice Try!"

        unlocknicetry: function() {

            Achieved.nicetry = "true";

            Achieves.push("\nNice Try (Right-click the cookie)");

            gameFunctions.inGameStuff.playChiev();

        },

        //This function unlocks "Won't Budge!"

        unlockwontbudge: function() {

            Achieved.wontbudge = "true";

            Achieves.push("\nWon't budge! (Middle-click the cookie after right-clicki\n-ng it)");

            gameFunctions.inGameStuff.playChiev();

        }

    },

    properCheats: {

        Spill\_The\_Milk: function() {

            cursors += 500000000;

            gMas += 50000000;

            cookies = 9999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999;

            gameFunctions.inGameStuff.Rot\_The\_Dough(true);

            allTimeCookies = cookies;

        }

    },

    other: {

        Blast\_To\_The\_Past: function() {

            Program.restart();

        }

    }

};

//where the true magic happens

var draw = function() {

    strokeWeight(1);

    stroke(0, 0, 0);

    background(120, 194, 255);

    frameRate(30);

     if (mouseIsPressed && mouseX > cookieHitboxX1 && mouseX < cookieHitboxX2 && mouseY > cookieHitboxY1 && mouseY < cookieHitboxY2 && mouseButton === LEFT){ //detects when you click on the cookie's hitbox

        cookieSize = 75; // makes the cookie smaller

        //changing stuff with the chips

        chipRad = 65;

        chipX = 18;

        chipY = 26;

    } else {

        cookieSize = 135; //makes the cookie its normal size

        //setting stuff with the chips to normal

        chipRad = 120;

        chipX = 30;

        chipY = 35;

    }

    //buy icon

    fill(61, 155, 255);

    rect(buyX, buyY, 204, buyH);

    fill(255, 255, 255);

    //price text

    textFont(font1);

    text(cursorPrice + " Cookies", buyX + 15, buyY + 65);

    //title for the buy icon

    textFont(font1);

    text("Cursor", buyX + 31, buyY + 14.3);

    //cursor count text

    textSize(28);

    text(cursors, buyX + 9, buyY + 36);

    //calls the function to draw the cursor (see way earlier in the code)

    drawCrsr(550, 315, 255, 255, 255);

    fill(61, 155, 255);

    rect(buyX, buy2Y, 204, buyH);

    fill(255, 255, 255);

    //price text

    textFont(font1);

    text(gMaPrice + " Co", buyX + 15, buy2Y + 65);

    //title for the buy icon

    textFont(font1);

    text("Grandma", buyX + 31, buy2Y + 14.3);

    //cursor count text

    textSize(28);

    text(gMas, buyX + 9, buy2Y + 36);

    //calls the function to draw grandma

    drawGMa(550, 380, false, 255, 0, 239);

    //shhhhhhhhhhh don't look or change, it's debug text

    fill(130, 193, 255);

    text(CrsrTime, 200, 200);

    //cookie count text

    fill(255, 255, 255);

    textFont(font2);

    textAlign(CENTER);

    text("Cookies: " + cookies, cookieX, 45);

    //nothing special

    textAlign(LEFT);

    //sets the framerate to the fps cap

    frameRate(fpsCap);

    //draws the cursors below the big cookie

    var crsrY2 = 417;

    for (var rep = 0; rep < cursors && rep < 5; rep++) {

        drawCrsr(cookieX, crsrY2, 255, 255, 255);

        crsrY2 += 75;

    }

    //the base of the cookie

    fill(173, 151, 26);

    ellipse(cookieX, cookieY, cookieSize, cookieSize);

    //sets the CpS

    CpS = ((round(cursors \* crsrLvl) / 10) + (gMas \* gmaLvl));

    //the chips in the cookie

    fill(135, 76, 10);

    ellipse(cookieX - chipX, cookieY - chipY, cookieSize - chipRad, cookieSize - chipRad);

    ellipse(cookieX, cookieY, cookieSize - (chipRad - 21), cookieSize - (chipRad - 21));

    ellipse(cookieX + chipX, cookieY - 25, cookieSize - (chipRad - 4.25), cookieSize - (chipRad - 4.25));

        //how cookies are gained

        mouseClicked = function(){

        if (mouseX > cookieHitboxX1 && mouseX < cookieHitboxX2 && mouseY > cookieHitboxY1 && mouseY < cookieHitboxY2 && mouseButton === LEFT){

            cookies += 1 \* clickLvl;

            allTimeCookies += 1 \* clickLvl;

        } else if(mouseX > cookieHitboxX1 && mouseX < cookieHitboxX2 && mouseY > cookieHitboxY1 && mouseY < cookieHitboxY2 && mouseButton === RIGHT && Achieved.nicetry === "false"){ //"Nice Try" Achieveement

                gameFunctions.inGameStuff.unlocknicetry();

        } else if(mouseX > cookieHitboxX1 && mouseX < cookieHitboxX2 && mouseY > cookieHitboxY1 && mouseY < cookieHitboxY2 && mouseButton === CENTER && Achieved.nicetry === "true" && Achieved.wontbudge === "false") { //"Won't Budge!" Achieveement

                gameFunctions.inGameStuff.unlockwontbudge();

            //how cursors are gained

            } else if (mouseX > buyHBX1 && mouseX < buyHBX2 && mouseY > buyHBY1 && mouseY < buyHBY2 && cookies >= cursorPrice){

                cursors += 1;

                cookies -= cursorPrice; //takes away cookies

                cursorPrice = 15 + (cursors \* 2); //changes the price

                buildings += 1;

            } else if (mouseX > buy2HBX1 && mouseX < buy2HBX2 && mouseY > buy2HBY1 && mouseY < buy2HBY2 && cookies >= gMaPrice) {

                gMas += 1;

                cookies -= gMaPrice;

                gMaPrice = 100 + (gMas \* 15);

                buildings += 1;

            }

        };

            //grandma timer

            if (gmaTime >= 1) {

                if (gMas >= 1) {

                    cookies += 1 \* gmaLvl;

                    allTimeCookies += 1 \* gmaLvl;

                }

                gmaTime = 0;

            } else {

                gmaTime += 0.04 \* (gMas);

            }

            //the timer for the cursor I worked so hard on (this is the main reason I'm making my own site)

            if (CrsrTime >= (10 / cursors)){

                if (cursors >= 1){

                    cookies += crsrLvl;

                    allTimeCookies += crsrLvl;

                }

                CrsrTime = 0;

            } else {

                CrsrTime += (1 / fpsCap);

            }

            //stats screen

            //acheivement handler (part 2, go back to somewhere near line 210 for part 1)

        //Cookie Achievements

            if (allTimeCookies >= 1 && Achieved.bakeginner === "false") {

                Achieved.bakeginner = "true";

                Achieves.push("\nBakeginner (bake 1 cookie)");

                gameFunctions.inGameStuff.playChiev();

            } else if (allTimeCookies >= 10 && Achieved.overnine === "false") {

                Achieved.overnine = "true";

                Achieves.push("\nIt's Over NINE! (bake 10 cookies)");

                gameFunctions.inGameStuff.playChiev();

            } else if (allTimeCookies >= 100 && Achieved.rollDough === "false") {

                Achieved.rollDough = "true";

                Achieves.push("\nRolling In the DOUGH (bake 100 cookies)");

                gameFunctions.inGameStuff.playChiev();

            } else if (allTimeCookies >= 1000 && Achieved.approach === "false") {

                Achieved.approach = "true";

                Achieves.push("\nOh? You're approaching my cookies? (bake 1,000 c\n-ookies)");

                gameFunctions.inGameStuff.playChiev();

            } else if (allTimeCookies >= 10000 && Achieved.toFeed === "false") {

                Achieved.toFeed = "true";

                Achieves.push("\nEnough to feed a highschool (bake 10,000 cookies)");

                gameFunctions.inGameStuff.playChiev();

        //Building Achievements

            } else if (buildings >= 1 && Achieved.fixIt === "false") {

                Achieved.fixIt = "true";

                Achieves.push("\nCan We Fix It? (Purchase a building)");

                gameFunctions.inGameStuff.playChiev();

            } else if (cursors >= 1 && Achieved.squeakSqueak === "false") {

                Achieved.squeakSqueak = "true";

                Achieves.push("\nSqueak, Squeak (purchase 1 cursor)");

                gameFunctions.inGameStuff.playChiev();

            } else if (cursors >= 10 && Achieved.muchClick === "false") {

                Achieved.muchClick = "true";

                Achieves.push("\nMuch click. So wow. (Own 10 cursors)");

                gameFunctions.inGameStuff.playChiev();

            } else if (gMas >= 1 && Achieved.okBoomer === "false") {

                Achieved.okBoomer = "true";

                Achieves.push("\nOk Boomer (Purchase 1 grandma)");

                gameFunctions.inGameStuff.playChiev();

            } else if (gMas >= 10 && Achieved.famBuis === "false") {

                Achieved.famBuis = "true";

                Achieves.push("\nFamily Buisness (Own 10 grandmas)");

                gameFunctions.inGameStuff.playChiev();

            } else if (millis() >= 1 && Achieved.consPrize === "false") {

                Achieved.consPrize = "true";

                Achieves.push("\nConsolation Prize (Boot up this game)");

                gameFunctions.inGameStuff.playChiev();

            }

            if (keyIsPressed && key.code === 32) {

                println("---\nALL ACHIEVEMENTS:\n" + Achieves + "\n---");

            }

            strokeWeight(3);

            var statX = 140;

            var statY = 1;

            fill(179, 118, 6);

            rect(statX, statY, 255, height - 1);

            fill(255, 255, 255);

            //title

            textSize(25);

            text("Stats", statX + 30, statY + 30);

            //actual stats text

            textSize(10);

            text(cookies + " cookie(s) in bank", statX + 10, statY + 72); //cookies in bank

            text(allTimeCookies + " cookie(s) baked (all time)", statX + 10, statY + 97); //all time cookie(s)

            text("CpS: " + CpS, statX + 10, statY + 118);  //CpS

            text("Buildings: " + buildings, statX + 10, statY + 139); //buildings

            text("Achievements (" + Achieves.length + "/" + (Object.keys(Achieved).length - 1) + ") (Press space to see all): " + Achieves, statX + 10, statY + 160); //I use all of these .length functions so that I can easily track how many Achievements you have to how many total are in the game. Also thanks to KA user "Kopter Coding" for the help with the total achievement count (with the Object.keys() part.)

            //cookie click upgrade icon code

            //the box around the upgrade's icon

            fill(117, 61, 6);

            stroke(26, 18, 0);

            strokeWeight(4);

            rect(clickX - 25, clickY, 53, 101);

            //the upgrade's actual icon

            strokeWeight(1);

            stroke(0, 0, 0);

            fill(44, 232, 242);

            rect(clickX - 10, clickY + 55, 25, 35);

            triangle(clickX - 10, clickY + 10, clickX - 10, clickY + 68, clickX + 16, clickY + 58);

            if (mouseX >= clickUpHBX1 && mouseX <= clickUpHBX2 - 15 && mouseY >= clickUpHBY1 && mouseY <= clickUpHBY2) {

                //info about the upgrade

                fill(117, 61, 6);

                stroke(26, 18, 0);

                strokeWeight(4);

                rect(clickX - 27, clickY - 96, 75, 93);

                fill(255, 255, 255);

                text("Clicking upgrade", clickX - 25, clickY - 88);

                text("Clicking upgrade", clickX - 25, clickY - 88);

                text("This makes click\n-ing the cookie\n2X as effective.", clickX - 25, clickY - 72.5);

                text(clickUpPrice + "\ncookies to buy", clickX - 25, clickY - 23.3);

                    if (cookies >= clickUpPrice && mouseIsPressed) {

                        clickLvl \*= 2;

                        cookies -= clickUpPrice;

                        clickUpPrice \*= 10;

                    }

            }

            if (cursors >= 1) {

                //the box around the cursor upgrade icon

                fill(117, 61, 6);

                stroke(26, 18, 0);

                strokeWeight(4);

                rect(crsrUpX - 10, clickY, 84, 101);

                //the cursor upgrade icon

                drawCrsr(crsrUpX + 30, clickY + 55, 44, 232, 242);

                if (mouseX >= crsrUpHBX1 && mouseX <= crsrUpHBX2 && mouseY >= crsrUpHBY1 && mouseY <= crsrUpHBY2) {

                    //info about the upgrade

                    fill(117, 61, 6);

                    stroke(26, 18, 0);

                    strokeWeight(4);

                    rect(crsrUpX - 10, clickY - 96, 84, 93);

                    fill(255, 255, 255);

                    text("Cursor upgrade", crsrUpX - 10, clickY - 88);

                    text("Cursor upgrade", crsrUpX - 10, clickY - 88);

                    text("This makes \ncursors 2X \nas effective.", crsrUpX - 10, clickY - 72.5);

                    text(crsrUpPrice + "\ncookies to buy", crsrUpX - 10, clickY - 23.3);

                    if (cookies >= crsrUpPrice && mouseIsPressed) {

                        crsrLvl \*= 2;

                        cookies -= crsrUpPrice;

                        crsrUpPrice \*= 10;

                    }

                }

            }

            if (gMas >= 1) {

                fill(117, 61, 6);

                stroke(26, 18, 0);

                strokeWeight(4);

                rect(gmaUpX, gmaUpY, 79, 81);

                strokeWeight(1);

                drawGMa(clickX + 15, clickY + 460, true, 44, 232, 242);

                if (mouseX >= gmaUpHBX1 && mouseX <= gmaUpHBX2 && mouseY >= gmaUpHBY1 && mouseY <= gmaUpHBY2) {

                    //info about the upgrade

                    fill(117, 61, 6);

                    stroke(26, 18, 0);

                    strokeWeight(4);

                    rect(gmaUpX, gmaUpY - 98, 84, 93);

                    fill(255, 255, 255);

                    text("Grandma upgrade", gmaUpX, gmaUpY - 88);

                    text("Grandma upgrade", gmaUpX, gmaUpY - 88);

                    text("This makes \ngrandmas 2X \nas effective.", gmaUpX, gmaUpY - 72.5);

                    text(gmaUpPrice + "\ncookies to buy", gmaUpX, gmaUpY - 23.3);

                    if (cookies >= gmaUpPrice && mouseIsPressed) {

                        gmaLvl \*= 2;

                        cookies -= gmaUpPrice;

                        gmaUpPrice \*= 10;

                    }

                }

            }

};

Version 0.0005421:

/\*

            this effect doesn't work properly on mobile devices, sorry mobile players:

              \_\_\_\_\_\_\_

             /       \

             \\_\_\_\_\_\_\_/

        \_\_     \_\_\_           \_\_

       |\_\_   /     \   | /  |\_\_

        \_\_   \_\_\_    \_\_\_         \_\_ \_\_    \_\_

        \_\_         \_\_ \_\_   \_\_          \_\_    \_\_

    A JAYDAR STUDIOS GAME

    FAKE COOKIE CLICKER DEFINITIVE EDITION, COPYRIGHT 2022, JAYDAR STUDIOS, INC.

	* /

/\*\*

    PATCH NOTES:

        V0.0005421 (Summer Cleaning(-ish) Update): Slight code cleanup.

        V0.000542 (And all that glitters looks old): Changed the default color of the Grandma, and fixed a minor bug where grandma upgrades didn't affect your CpS in the Stats page.

        V0.000541 (Gigantamax Fix): Fixed the Grandma Upgrade.

        V0.00054 (Gigantamax Evolve-able Grandmas): I added an upgrade for the Grandma.

        V0.000532 (Futureproofing Update): As I'm worried of not being able to see all of the achievements, a way to see them all was added, for futureproofing.

        V0.000531 (Summer(-ish) Cleaning Update): Cleaned up a bit of code, more specifically, adding some sub-objects into the game object, moving some functions into the same object, and making the first ever officially-named update! (also edited the patch notes for the previous update.)

        V0.00053: Added some cheats, and the first ever Shadow Achievement (hint: try a 'le hack'.)

        V0.000522: Added a couple achievements.

        V0.000521: Fixed a bug with the cursor.

        V0.00052: Added a lot more achievements (more specifically 5), along with a bit more clarification to the "Achievs" object.

        V0.000513: Added a "Speedrunner's Guide".

        V0.000512: Fixed a bug with the "Won't Budge" achievement where you could get it multiple times and fixed a bug where you might not get cookie achievements if you ran the game in the background.

        V0.000511: Fixed an extremely small bug with the "Can We Fix It?" Achievement.

        V0.00051: Fixed the Grandma (in multiple ways).

        V0.0005: Added Grandma and an extra Achieveeement.

        V0.00045: Added acheivements.

        V0.00044: Added upgrades for cursors.

        V0.00043: Added the fist upgrade of many to come, that upgrade being an upgrade to the cookie clicks.

        V0.000421: Added graphics for a prototype upgrade for cookie clicks

        V0.00042: Added the info board (kinda)

        V0.00041: Made cursors appear underneath the big cookie

        V0.0004: FINALLY FINISHED THE CURSOR (kinda, I need to add it underneath the cookie and add info when the buy icon is hovered over, but still!)

        V0.00031: Added more graphics for when I actually implement the cursor and changed to a version number rather than a prototype number

        V0.00030 (prototype 3): Tried to do more work, ended up doing about nothing

        V0.00025 (prototype 2.5): Added a rectangle

        V0.00020 (prototype 2): Finished the chips

        V0.00010 (prototype 1): Original prototype release

	* /

/\*

    To do (most important to least important):

    Add saving

    Fix the big cookie's hitbox to make it a circle

    Add SFX

    Once the info board is added, I need to make sure the cookie count text doesn't overlap with the info board.

    Add the news ticker

    Add particles

    Add bulk buying

    Add debug features

    Maybe create a seperate website for this game????? (I'm kinda limited in Khan Academy)

	* /

/\*

    DONE (oldest to latest):

    Finish the Cursor

    Add the info board (sorta)

    Added an upgrade for clicking the cookie! (HERE COMES THE HYPE TRAIN!!!!!!!!!!!!!!)

    Added an upgrade for the cursor (THOMAS THE HYPE TRAIN LEVELS OF HYPE)

	* /

/\*\*

    And now, the offical speedrunner's guide to DE speedruns, made by Jaydar:

        SPEEDRUN CATEGORIES:

    10K cookies (earn 10 thousand cookies all-time w/o messing with the code.)

    1M cookies (earn 1 million cookies all-time w/o messing with the code.)

    All Achievements (Earn every achievement in the game w/o messing with the code.)

        SUBCATEGORIES:

    Any% (beating that category in any way, while still obeying the main category's rules)

    Low click% (beating that category while clicking the cookie the least amount of times)

        CATEGORY EXSTENSIONS:

    ACE (Messing with the game's code to get to 1 Million cookies. Cookie clicks are NOT ALLOWED!)

    short% (An extremely short run where you have to get these achievements: "Bakeginner", "Nice try", and "Won't Budge!")

    timetravel% (A run where you have to get 10 cookies in every version of the game.)

    That's it; enjoy running these categories soon!

    NOTE: Speedrun leaderboards on speedrun.com aren't ready yet, but you can still record speedruns in advance.

	* + /

/\*\*

        FEATURES:

    - A big cookie

    - Buyable Cursors and Grandmas

    - Upgrades

    - Stats

    - Achievements

    - Cookies

    - And soon enough, speedrun.com leaderboards(?)! (The future for speedrun leaderboards are uncertain right now.)

/\*\*

                CREDITS:

Cookie clicker is by Orteil, I have his thanks for this project, as it's his concept.

Fake Cookie clicker and Fake Cookie Clicker: Definitive Edition by me, copyright 2021 - 2022.

Code is by me, unless I say "This code is by (so and so)."

Graphics are by me.

	* /

//enough boring stuff, here comes the code:

//this sets the fps cap to 30 (like in OG cookie clicker)

var fpsCap = 30;

//variables for the cookie's location

var cookieSize = 135;

var cookieX = 70;

var cookieY = 300;

    //variables for the cookie's (currently slightly janky) hitbox

    var cookieHitboxX1 = cookieX - 45;

    var cookieHitboxX2 = cookieHitboxX1 + cookieSize;

    var cookieHitboxY1 = cookieY - (cookieSize / 2);

    var cookieHitboxY2 = cookieY + (cookieSize / 2);

    //cookie count setup

    var cookies = 0;

    //all time cookies setup

    var allTimeCookies = 0;

    //cookies per second setup

    var CpS = 0;

    //variables for the chips

    var chipX = 30;

    var chipY = 35;

    var chipRad = 120;

//variables for the building buy icon

var buyX = 395;

var buyY = 265;

var buyW = 205;

var buyH = 75;

//variables for the cursor

var cursors = 0;

var cursorPrice = 15 + (cursors \* 2);

//variables for the building buy icon's hitbox

var buyHBX1 = buyX;

var buyHBX2 = buyHBX1 + buyW;

var buyHBY1 = buyY;

var buyHBY2 = buyHBY1 + buyH;

//buy things font

var font1 = createFont("monospace", 18);

//cookie count font

var font2 = createFont("sans-serif", 10);

//this function draws the cursor

var drawCrsr = function(crsrX, crsrY, crsrHue1, crsrHue2, crsrHue3) {

    strokeWeight(1);

    fill(crsrHue1, crsrHue2, crsrHue3);

    //base of the cursor

    ellipse(crsrX, crsrY, 72, 45);

    //the fingers (YES I KNOW THERE'S ONLY 4 FINGERS I'M JUST TOO LAZY TO ADD ANOTHER)

    rect((crsrX + 13) - 45, (crsrY + 48) - (45 \* 2), 20, 32);

    rect((crsrX + 33) - 45, (crsrY + 39) - (45 \* 2), 20, 32);

    rect((crsrX + 51) - 45, (crsrY + 45) - (45 \* 2), 20, 32);

    rect((crsrX + 65) - 45, (crsrY + 53) - (45 \* 2), 20, 32);

};

//Timer for the cursor

var CrsrTime = 0;

//grandma stuff

//pos

var buy2Y = buyY + 75;

//price

var gMaPrice = 100;

//# owned

var gMas = 0;

//draw grandma (credits to FANDOM wiki user and fellow admin, A2A2tgt)

var drawGMa = function(gMaX, gMaY, hueChange, gMaH1, gMaH2, gMaH3) {

    if (hueChange === false) {

        fill(214, 160, 160);

    } else {

        fill(gMaH1, gMaH2, gMaH3);

    }

    ellipse(gMaX, gMaY, 65, 65);

    fill(235, 129, 171);

    ellipse(gMaX, gMaY + 15, 25, 5);

    fill(191, 242, 239);

    ellipse(gMaX - 13, gMaY - 11.5, 15, 15);

    ellipse(gMaX + 13, gMaY - 11.5, 15, 15);

    fill(0, 0, 0);

    arc(gMaX, gMaY - 10, 15, 0, 0, 180);

};

//hitboxes

var buy2HBX1 = buyX;

var buy2HBX2 = buyX + buyW;

var buy2HBY1 = buy2Y;

var buy2HBY2 = buy2Y + buyH;

var gmaTime = 0;

//Tracks the upgrade level of clicking the cookie

var clickLvl = 1;

//tracks the price of the click upgrade

var clickUpPrice = 100;

//Tracks the pos of the click upgrade's triangle

var clickX = 424;

var clickY = 97;

//tracks the upgrade level of the cursor

var crsrLvl = 1;

//variables for the click upgrade's hitbox

var clickUpHBX1 = clickX - 25;

var clickUpHBX2 = clickUpHBX1 + 72;

var clickUpHBY1 = clickY - 10;

var clickUpHBY2 = clickUpHBY1 + 101;

//tracks the price of the cursor uprade

var crsrUpPrice = 250;

//tracks the x pos of the cursor upgrade

var crsrUpX = clickX + 51;

//variables for the cursor upgrade hitbox

var crsrUpHBX1 = crsrUpX;

var crsrUpHBX2 = crsrUpHBX1 + 84;

var crsrUpHBY1 = clickY;

var crsrUpHBY2 = crsrUpHBY1 + 101;

//tracks the upgrade level of the grandma

var gmaLvl = 1;

var gmaUpX = clickX - 25;

var gmaUpY = clickY + 420;

//grandma upgrade hitbox

var gmaUpHBX1 = gmaUpX;

var gmaUpHBX2 = gmaUpHBX1 + 79;

var gmaUpHBY1 = gmaUpY;

var gmaUpHBY2 = gmaUpHBY1 + 81;

var gmaUpPrice = 500;

//Building count

var buildings = 0;

//This one is full of cheats and other misc. functions for screwing around.

var game = {

    variables: {

        //Achievement handling (part 1)

        //an object that stores Achievements. I abbreviated the names in the code, but I'll use comments to display the achievement's actual name for you fellow nosy nerds. (You're welcome, by the way!)

        Achieved: {

            consPrize: "false", // This is for "Consolation Prize"

            bakeginner: "false", // This is for "Bakeginner"

            overnine: "false", // This is for "It's over NINE!"

            approach: "false", // This is for "Oh? You're approaching my cookies?"

            rollDough: "false", // This is for "Rolling In The DOUGH"

            toFeed: "false", // This is for "Enough To Feed A Highschool"

            fixIt: "false", // This is for "Can We Fix It?"

            squeakSqueak: "false", // This is for "Squeak, Squeak"

            muchClick: "false",

            okBoomer: "false", // This is for "Ok Boomer"

            famBuis: "false",

            nicetry: "false", // This is for "Nice Try"

            wontbudge: "false", // This is for "Won't Budge"

            rotDough: "false"

        },

        //array that displays Achievements on the stats screen, as names and requirements are added to the array.

        Achieves: []

    },

    functions: {

        inGameStuff: {

            Rot\_The\_Dough: function(ruinTxt) {

                if (game.variables.Achieved.rotDough === "false") {

                    game.variables.Achieved.rotDough = "true";

                    var sndPly = function() {

                        var snd2 = getSound("retro/coin");

                        snd2.audio.volume = 1;

                        snd2.audio.preservesPitch = false;

                        snd2.audio.playbackRate = 0.5;

                        playSound(snd2);

                    };

                    sndPly();

                    game.variables.Achieves.push("\nRotten Dough (Shadow Achievement)");

                }

                if (ruinTxt === true) {

                    println("Great job, you frickin idiot. You ruined any and all fun you could've had.\nFor your dastardly deeds, take this special Shadow Achievement as a badge that will \nwarn everyone to stay away from you. \nSorry, I got off on a tangent there. I'm just saying, you're missing out. \nAnyways, I gotta go. Once again, sorry for the tangent. Keep on clicking, and enjoy this stupid game! - Jaydar");

                }

            },

            //this just plays the SFX for Achievements

            playChiev: function() {

                var snd = getSound("retro/coin");

                snd.audio.volume = 0.095;

                snd.audio.playbackRate = 1;

                playSound(snd);

            },

            //This unlocks "Nice Try!"

            unlocknicetry: function() {

                game.variables.Achieved.nicetry = "true";

                game.variables.Achieves.push("\nNice Try (Right-click the cookie)");

                game.functions.inGameStuff.playChiev();

            },

            //This function unlocks "Won't Budge!"

            unlockwontbudge: function() {

                game.variables.Achieved.wontbudge = "true";

                game.variables.Achieves.push("\nWon't budge! (Middle-click the cookie after right-clicki\n-ng it)");

                game.functions.inGameStuff.playChiev();

            }

        },

        properCheats: {

            Spill\_The\_Milk: function() {

                cursors += 500000000;

                gMas += 50000000;

                cookies = 9999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999;

                game.functions.inGameStuff.Rot\_The\_Dough(true);

                allTimeCookies = cookies;

            }

        },

        other: {

            Blast\_To\_The\_Past: function() {

                Program.restart();

            }

        }

    }

};

//where the true magic happens

var draw = function() {

    strokeWeight(1);

    stroke(0, 0, 0);

    background(120, 194, 255);

    frameRate(30);

     if (mouseIsPressed && mouseX > cookieHitboxX1 && mouseX < cookieHitboxX2 && mouseY > cookieHitboxY1 && mouseY < cookieHitboxY2 && mouseButton === LEFT){ //detects when you click on the cookie's hitbox

        cookieSize = 75; // makes the cookie smaller

        //changing stuff with the chips

        chipRad = 65;

        chipX = 18;

        chipY = 26;

    } else {

        cookieSize = 135; //makes the cookie its normal size

        //setting stuff with the chips to normal

        chipRad = 120;

        chipX = 30;

        chipY = 35;

    }

    //buy icon

    fill(61, 155, 255);

    rect(buyX, buyY, 204, buyH);

    fill(255, 255, 255);

    //price text

    textFont(font1);

    text(cursorPrice + " Cookies", buyX + 15, buyY + 65);

    //title for the buy icon

    textFont(font1);

    text("Cursor", buyX + 31, buyY + 14.3);

    //cursor count text

    textSize(28);

    text(cursors, buyX + 9, buyY + 36);

    //calls the function to draw the cursor (see way earlier in the code)

    drawCrsr(550, 315, 255, 255, 255);

    fill(61, 155, 255);

    rect(buyX, buy2Y, 204, buyH);

    fill(255, 255, 255);

    //price text

    textFont(font1);

    text(gMaPrice + " Cookies", buyX + 15, buy2Y + 65);

    //title for the buy icon

    textFont(font1);

    text("Grandma", buyX + 31, buy2Y + 14.3);

    //cursor count text

    textSize(28);

    text(gMas, buyX + 9, buy2Y + 36);

    //calls the function to draw grandma

    drawGMa(550, 380, false, 255, 0, 239);

    //shhhhhhhhhhh don't look or change, it's debug text

    fill(130, 193, 255);

    text(CrsrTime, 200, 200);

    //cookie count text

    fill(255, 255, 255);

    textFont(font2);

    textAlign(CENTER);

    text("Cookies: " + cookies, cookieX, 45);

    //nothing special

    textAlign(LEFT);

    //sets the framerate to the fps cap

    frameRate(fpsCap);

    //draws the cursors below the big cookie

    var crsrY2 = 417;

    for (var rep = 0; rep < cursors && rep < 5; rep++) {

        drawCrsr(cookieX, crsrY2, 255, 255, 255);

        crsrY2 += 75;

    }

    //the base of the cookie

    fill(173, 151, 26);

    ellipse(cookieX, cookieY, cookieSize, cookieSize);

    //sets the CpS

    CpS = ((round(cursors \* crsrLvl) / 10) + (gMas \* gmaLvl));

    //the chips in the cookie

    fill(135, 76, 10);

    ellipse(cookieX - chipX, cookieY - chipY, cookieSize - chipRad, cookieSize - chipRad);

    ellipse(cookieX, cookieY, cookieSize - (chipRad - 21), cookieSize - (chipRad - 21));

    ellipse(cookieX + chipX, cookieY - 25, cookieSize - (chipRad - 4.25), cookieSize - (chipRad - 4.25));

        //how cookies are gained

        mouseClicked = function(){

        if (mouseX > cookieHitboxX1 && mouseX < cookieHitboxX2 && mouseY > cookieHitboxY1 && mouseY < cookieHitboxY2 && mouseButton === LEFT){

            cookies += 1 \* clickLvl;

            allTimeCookies += 1 \* clickLvl;

        } else if(mouseX > cookieHitboxX1 && mouseX < cookieHitboxX2 && mouseY > cookieHitboxY1 && mouseY < cookieHitboxY2 && mouseButton === RIGHT && game.variables.Achieved.nicetry === "false"){ //"Nice Try" Achieveement

                game.functions.inGameStuff.unlocknicetry();

        } else if(mouseX > cookieHitboxX1 && mouseX < cookieHitboxX2 && mouseY > cookieHitboxY1 && mouseY < cookieHitboxY2 && mouseButton === CENTER && game.variables.Achieved.nicetry === "true" && game.variables.Achieved.wontbudge === "false") { //"Won't Budge!" Achieveement

                game.functions.inGameStuff.unlockwontbudge();

            //how cursors are gained

            } else if (mouseX > buyHBX1 && mouseX < buyHBX2 && mouseY > buyHBY1 && mouseY < buyHBY2 && cookies >= cursorPrice){

                cursors += 1;

                cookies -= cursorPrice; //takes away cookies

                cursorPrice = 15 + (cursors \* 2); //changes the price

                buildings += 1;

            } else if (mouseX > buy2HBX1 && mouseX < buy2HBX2 && mouseY > buy2HBY1 && mouseY < buy2HBY2 && cookies >= gMaPrice) {

                gMas += 1;

                cookies -= gMaPrice;

                gMaPrice = 100 + (gMas \* 15);

                buildings += 1;

            }

        };

            //grandma timer

            if (gmaTime >= 1) {

                if (gMas >= 1) {

                    cookies += 1 \* gmaLvl;

                    allTimeCookies += 1 \* gmaLvl;

                }

                gmaTime = 0;

            } else {

                gmaTime += 0.04 \* (gMas);

            }

            //the timer for the cursor I worked so hard on (this is the main reason I'm making my own site)

            if (CrsrTime >= (10 / cursors)){

                if (cursors >= 1){

                    cookies += crsrLvl;

                    allTimeCookies += crsrLvl;

                }

                CrsrTime = 0;

            } else {

                CrsrTime += (1 / fpsCap);

            }

            //stats screen

            //acheivement handler (part 2, go back to somewhere near line 210 for part 1)

        //Cookie Achievements

            if (allTimeCookies >= 1 && game.variables.Achieved.bakeginner === "false") {

                game.variables.Achieved.bakeginner = "true";

                game.variables.Achieves.push("\nBakeginner (bake 1 cookie)");

                game.functions.inGameStuff.playChiev();

            } else if (allTimeCookies >= 10 && game.variables.Achieved.overnine === "false") {

                game.variables.Achieved.overnine = "true";

                game.variables.Achieves.push("\nIt's Over NINE! (bake 10 cookies)");

                game.functions.inGameStuff.playChiev();

            } else if (allTimeCookies >= 100 && game.variables.Achieved.rollDough === "false") {

                game.variables.Achieved.rollDough = "true";

                game.variables.Achieves.push("\nRolling In the DOUGH (bake 100 cookies)");

                game.functions.inGameStuff.playChiev();

            } else if (allTimeCookies >= 1000 && game.variables.Achieved.approach === "false") {

                game.variables.Achieved.approach = "true";

                game.variables.Achieves.push("\nOh? You're approaching my cookies? (bake 1,000 c\n-ookies)");

                game.functions.inGameStuff.playChiev();

            } else if (allTimeCookies >= 10000 && game.variables.Achieved.toFeed === "false") {

                game.variables.Achieved.toFeed = "true";

                game.variables.Achieves.push("\nEnough to feed a highschool (bake 10,000 cookies)");

                game.functions.inGameStuff.playChiev();

        //Building Achievements

            } else if (buildings >= 1 && game.variables.Achieved.fixIt === "false") {

                game.variables.Achieved.fixIt = "true";

                game.variables.Achieves.push("\nCan We Fix It? (Purchase a building)");

                game.functions.inGameStuff.playChiev();

            } else if (cursors >= 1 && game.variables.Achieved.squeakSqueak === "false") {

                game.variables.Achieved.squeakSqueak = "true";

                game.variables.Achieves.push("\nSqueak, Squeak (purchase 1 cursor)");

                game.functions.inGameStuff.playChiev();

            } else if (cursors >= 10 && game.variables.Achieved.muchClick === "false") {

                game.variables.Achieved.muchClick = "true";

                game.variables.Achieves.push("\nMuch click. So wow. (Own 10 cursors)");

                game.functions.inGameStuff.playChiev();

            } else if (gMas >= 1 && game.variables.Achieved.okBoomer === "false") {

                game.variables.Achieved.okBoomer = "true";

                game.variables.Achieves.push("\nOk Boomer (Purchase 1 grandma)");

                game.functions.inGameStuff.playChiev();

            } else if (gMas >= 10 && game.variables.Achieved.famBuis === "false") {

                game.variables.Achieved.famBuis = "true";

                game.variables.Achieves.push("\nFamily Buisness (Own 10 grandmas)");

                game.functions.inGameStuff.playChiev();

            } else if (millis() >= 1 && game.variables.Achieved.consPrize === "false") {

                game.variables.Achieved.consPrize = "true";

                game.variables.Achieves.push("\nConsolation Prize (Boot up this game)");

                game.functions.inGameStuff.playChiev();

            }

            if (keyIsPressed && key.code === 32) {

                println("---\nALL ACHIEVEMENTS:\n" + game.variables.Achieves + "\n---");

            }

            strokeWeight(3);

            var statX = 140;

            var statY = 1;

            fill(179, 118, 6);

            rect(statX, statY, 255, height - 1);

            fill(255, 255, 255);

            //title

            textSize(25);

            text("Stats", statX + 30, statY + 30);

            //actual stats text

            textSize(10);

            text(cookies + " cookie(s) in bank", statX + 10, statY + 72); //cookies in bank

            text(allTimeCookies + " cookie(s) baked (all time)", statX + 10, statY + 97); //all time cookie(s)

            text("CpS: " + CpS, statX + 10, statY + 118);  //CpS

            text("Buildings: " + buildings, statX + 10, statY + 139); //buildings

            text("Achievements (" + game.variables.Achieves.length + "/" + (Object.keys(game.variables.Achieved).length - 1) + ") (Press space to see all): " + game.variables.Achieves, statX + 10, statY + 160); //I use all of these .length functions so that I can easily track how many Achievements you have to how many total are in the game. Also thanks to KA user "Kopter Coding" for the help with the total achievement count (with the Object.keys() part.)

            //cookie click upgrade icon code

            //the box around the upgrade's icon

            fill(117, 61, 6);

            stroke(26, 18, 0);

            strokeWeight(4);

            rect(clickX - 25, clickY, 53, 101);

            //the upgrade's actual icon

            strokeWeight(1);

            stroke(0, 0, 0);

            fill(44, 232, 242);

            rect(clickX - 10, clickY + 55, 25, 35);

            triangle(clickX - 10, clickY + 10, clickX - 10, clickY + 68, clickX + 16, clickY + 58);

            if (mouseX >= clickUpHBX1 && mouseX <= clickUpHBX2 - 15 && mouseY >= clickUpHBY1 && mouseY <= clickUpHBY2) {

                //info about the upgrade

                fill(117, 61, 6);

                stroke(26, 18, 0);

                strokeWeight(4);

                rect(clickX - 27, clickY - 96, 75, 93);

                fill(255, 255, 255);

                text("Clicking upgrade", clickX - 25, clickY - 88);

                text("Clicking upgrade", clickX - 25, clickY - 88);

                text("This makes click\n-ing the cookie\n2X as effective.", clickX - 25, clickY - 72.5);

                text(clickUpPrice + "\ncookies to buy", clickX - 25, clickY - 23.3);

                    if (cookies >= clickUpPrice && mouseIsPressed) {

                        clickLvl \*= 2;

                        cookies -= clickUpPrice;

                        clickUpPrice \*= 10;

                    }

            }

            if (cursors >= 1) {

                //the box around the cursor upgrade icon

                fill(117, 61, 6);

                stroke(26, 18, 0);

                strokeWeight(4);

                rect(crsrUpX - 10, clickY, 84, 101);

                //the cursor upgrade icon

                drawCrsr(crsrUpX + 30, clickY + 55, 44, 232, 242);

                if (mouseX >= crsrUpHBX1 && mouseX <= crsrUpHBX2 && mouseY >= crsrUpHBY1 && mouseY <= crsrUpHBY2) {

                    //info about the upgrade

                    fill(117, 61, 6);

                    stroke(26, 18, 0);

                    strokeWeight(4);

                    rect(crsrUpX - 10, clickY - 96, 84, 93);

                    fill(255, 255, 255);

                    text("Cursor upgrade", crsrUpX - 10, clickY - 88);

                    text("Cursor upgrade", crsrUpX - 10, clickY - 88);

                    text("This makes \ncursors 2X \nas effective.", crsrUpX - 10, clickY - 72.5);

                    text(crsrUpPrice + "\ncookies to buy", crsrUpX - 10, clickY - 23.3);

                    if (cookies >= crsrUpPrice && mouseIsPressed) {

                        crsrLvl \*= 2;

                        cookies -= crsrUpPrice;

                        crsrUpPrice \*= 10;

                    }

                }

            }

            if (gMas >= 1) {

                fill(117, 61, 6);

                stroke(26, 18, 0);

                strokeWeight(4);

                rect(gmaUpX, gmaUpY, 79, 81);

                strokeWeight(1);

                drawGMa(clickX + 15, clickY + 460, true, 44, 232, 242);

                if (mouseX >= gmaUpHBX1 && mouseX <= gmaUpHBX2 && mouseY >= gmaUpHBY1 && mouseY <= gmaUpHBY2) {

                    //info about the upgrade

                    fill(117, 61, 6);

                    stroke(26, 18, 0);

                    strokeWeight(4);

                    rect(gmaUpX, gmaUpY - 98, 84, 93);

                    fill(255, 255, 255);

                    text("Grandma upgrade", gmaUpX, gmaUpY - 88);

                    text("Grandma upgrade", gmaUpX, gmaUpY - 88);

                    text("This makes \ngrandmas 2X \nas effective.", gmaUpX, gmaUpY - 72.5);

                    text(gmaUpPrice + "\ncookies to buy", gmaUpX, gmaUpY - 23.3);

                    if (cookies >= gmaUpPrice && mouseIsPressed) {

                        gmaLvl \*= 2;

                        cookies -= gmaUpPrice;

                        gmaUpPrice \*= 10;

                    }

                }

            }

};