Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <stdlib.h>
- #include <stdbool.h>
- int main()
- {
- int amountOfCookies=0, cookiePower=10, alternateCookiePower;
- int cookieInputNumber=1, alternateCookieInputNumber, shopAccessNumber=0;
- int showCookiesNumber=2, changeControlsNumber=101, showControlsNumber=100, quitGameNumber=69;
- int cookieModeInput, shopModeInput;
- int cursorNumber=0, cursorPrice, bakerNumber=0, bakerPrice;
- bool saveCode=0, intro=1, changeControls=0, keepControls=0, correctControls=0, quitGame=0, inGame=1, cookieMode=1, shopMode=0, shopEnteredBefore=0, boughtSomething=1, firstTimeAtIntro=1;;
- printf("Welcome to Cookie Clicker!\nDo you have a save code?(1 for yes, 0 for no).\n");
- scanf("%d", &saveCode);
- if (saveCode==1)
- {
- intro=0;
- scanf("%d %d %d", &amountOfCookies, &cursorNumber, &bakerNumber);
- cookiePower+=cursorNumber;
- }
- else if (saveCode!=0)
- printf("Please try again!");
- if (intro==1)
- {
- printf("In the beginning, you get 1 cookie each time.\nYou can buy things to help you with getting more cookies.\n");
- printf("In case you want to other controls, \ntype in %d anywhere during the game.\n", showControlsNumber);
- printf("Do you wish to change the default controls?(1 for yes, 0 for no)\n");
- scanf("%d", &changeControls);
- if (changeControls==0)
- {
- printf("\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\nTo click a cookie, use %d\nTo go to the shop, use %d\n", cookieInputNumber, shopAccessNumber);
- intro=0;
- }
- }
- while (quitGame==0)
- {
- while (changeControls==1)
- {
- printf("What number do you want to use to click the cookies?(default \"%d\")\n",cookieInputNumber);
- scanf("%d",&cookieInputNumber);
- printf("What number for shop?(default \"%d\")\n", shopAccessNumber);
- scanf("%d",&shopAccessNumber);
- if (shopAccessNumber!=cookieInputNumber)
- correctControls=1;
- while (correctControls==0)
- {
- printf("You can't do that. Please try again");
- scanf("%d", &shopAccessNumber);
- if (shopAccessNumber!=cookieInputNumber)
- correctControls=1;
- }
- printf("What number do you want to use to show\nthe amount of cookies you have at anytime(default \"%d\")?\n", showCookiesNumber);
- scanf("%d", &showCookiesNumber);
- printf("Do you want to keep these controls?(1 for yes, 0 for no)\n");
- scanf("%d", &keepControls);
- changeControls=!keepControls;
- if (changeControls==0)
- inGame=1;
- printf("\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n");
- }
- if (firstTimeAtIntro==1)
- {
- printf("Start fabricating cookies!\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n");
- firstTimeAtIntro=0;
- }
- else
- printf("Get back to cookie fabricating!\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n");
- alternateCookieInputNumber=cookieInputNumber*11;
- while(inGame==1)
- {
- while(cookieMode==1)
- {
- if (shopEnteredBefore==1)
- printf("Welcome back to your cookie fabricator!\n");
- alternateCookiePower=cookiePower*2;
- scanf("%d",&cookieModeInput);
- if (cookieModeInput==cookieInputNumber)
- {
- amountOfCookies+=cookiePower;
- if (cookiePower==1)
- printf("Made %d cookie!\n", cookiePower);
- else
- printf("Made %d cookies!\n", cookiePower);
- }
- else if (cookieModeInput==alternateCookieInputNumber)
- {
- amountOfCookies+=alternateCookiePower;
- printf("Made %d cookies!\n", alternateCookiePower);
- }
- else if (cookieModeInput==showCookiesNumber)
- printf("Cookies: %d\n", amountOfCookies);
- else if (cookieModeInput==shopAccessNumber)
- {
- cookieMode=0;
- shopMode=1;
- }
- else if (cookieModeInput==changeControlsNumber)
- {
- changeControls=1;
- cookieMode=0;
- inGame=0;
- }
- else if (cookieModeInput==quitGameNumber)
- {
- cookieMode=0;
- inGame=0;
- quitGame=1;
- }
- else if (cookieModeInput==showControlsNumber)
- {
- printf("To click cookies: %d\nTo show amount of cookies: %d\n", cookieInputNumber, showCookiesNumber);
- printf("To go to the shop: %d\nTo change controls: %d\n", shopAccessNumber, changeControlsNumber);
- printf("To show controls again: %d\nTo quit the game: %d\n", showControlsNumber, quitGameNumber);
- printf("Got it? Ok resume collecting cookies!\n");
- }
- }
- if (shopMode==1)
- {
- if (shopEnteredBefore==0)
- {
- printf("Welcome to the shop!(Exit:0)\n");
- shopEnteredBefore=1;
- }
- else
- printf("Welcome back to the shop!\n");
- while (shopMode==1)
- {
- cursorPrice=500+(cursorNumber*cursorNumber*400);
- bakerPrice=1000+(cursorNumber*cursorNumber*600);
- if (boughtSomething==1)
- {
- printf("Cookies: %d\n\n", amountOfCookies);
- printf("Number\t\t%-4s\t\t%-10s", "Name", "Price\t\tYou Have\tAdded CPC\n");
- printf("<1>\t\t%s(1)\t%-d\t\t%d\t\t%d\n", "Cursor", cursorPrice, cursorNumber, cursorNumber);
- printf("<2>\t\t%s(5)\t%-d\t\t%d\t\t%d\n", "Baker", bakerPrice, bakerNumber, bakerNumber*5);
- }
- else
- printf("You only have %d cookies.\n", amountOfCookies);
- scanf("%d",&shopModeInput);
- if (shopModeInput==1)
- {
- if (amountOfCookies>=cursorPrice)
- {
- printf("You bought 1 Cursor for %d\n", cursorPrice);
- cursorNumber++;
- cookiePower++;
- amountOfCookies-=cursorPrice;
- boughtSomething=1;
- }
- else
- {
- printf("You don't have enough cookies.\n");
- boughtSomething=0;
- }
- }
- else if (shopModeInput==2)
- {
- if (amountOfCookies>=bakerPrice)
- {
- printf("You bought 1 Baker for %d\n", bakerPrice);
- cursorNumber++;
- cookiePower++;
- amountOfCookies-=bakerPrice;
- boughtSomething=1;
- }
- else
- {
- printf("You don't have enough cookies.\n");
- boughtSomething=0;
- }
- }
- else if (shopModeInput==0)
- {
- printf("You have exit the shop.\n");
- shopMode=0;
- cookieMode=1;
- }
- }
- }
- }
- }
- printf("Keep this code safe.\n");
- printf("%d %d %d\n", amountOfCookies, cursorNumber, bakerNumber);
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement