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, exitIntro=0;
- int cookieClickNumber=1, alternateCookieClickNumber, showCookiesNumber=2, showBoughtItems=3;
- int shopAccessNumber=0, showControlMenu=100;
- int showControlsNumber=1, showSaveCodeNumber=2, quitGameNumber=3;
- int cookieModeInput, shopModeInput, controlModeInput=-1;
- int cursorNumber=0, cursorPrice, bakerNumber=0, bakerPrice;
- bool saveCode=0, printMessage=1, inGame=1, cookieMode=1, shopMode=0, controlMode=0, shopEnteredBefore=0;
- bool boughtSomething=1, generateSaveCodeBeforeExit=0, sureToQuit=0, quitLoop=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)
- {
- printf("Load: ");
- scanf("%d %d %d", &amountOfCookies, &cursorNumber, &bakerNumber);
- cookiePower+=cursorNumber;
- exitIntro=1;
- }
- else if (saveCode!=0)
- printf("Please try again!");
- if (exitIntro==0)
- {
- printf("In the beginning, you get 10 cookie each time.\nYou can buy things to help you with getting more cookies.\n");
- printf("To access the controls menu, \ntype in %d anywhere during the game.\n", showControlMenu);
- printf("Press 1 to continue.\n");
- scanf("%d", &exitIntro);
- while (exitIntro!=1)
- {
- printf("Please try again.\n");
- scanf("%d", &exitIntro);
- }
- }
- while(inGame==1)
- {
- if (printMessage==1)
- {
- printf("\nStart fabricating cookies!\nHave fun!\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n");
- printMessage=0;
- }
- while (controlMode==1)
- {
- quitLoop=1;
- printf("Control Menu\n\n<1> Show Controls\n<2> Generate Save Code\n<3> Quit Game\n");
- if (controlModeInput==-1)
- printf("\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n");
- else if (controlModeInput<-1 || controlModeInput>quitGameNumber)
- {
- printf("\n\n");
- printf("Unknown command");
- printf("\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n");
- }
- else if (controlModeInput==showControlsNumber)
- {
- printf("\n\n");
- printf("Controls\n");
- printf("Click cookie: %d\n", cookieClickNumber);
- printf("Go to shop: %d\n", shopAccessNumber);
- printf("Access Control Menu: %d\n", showControlMenu);
- printf("\n\n\n\n\n\n\n\n\n\n\n\n\n");
- }
- else if (controlModeInput==showSaveCodeNumber)
- {
- printf("\n\n");
- printf("Save Code: %d %d %d\n", amountOfCookies, cursorNumber, bakerNumber);
- printf("\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n");
- }
- else if (controlModeInput==0)
- {
- controlMode=0;
- cookieMode=1;
- controlModeInput=-1;
- }
- scanf("%d", &controlModeInput);
- if (controlModeInput==quitGameNumber)
- {
- printf("Are you sure you want to quit the game? (1 for yes, 0 for no)\n");
- scanf("%d", &sureToQuit);
- while (quitLoop==1)
- {
- if (sureToQuit==1)
- {
- controlMode=0;
- inGame=0;
- quitLoop=0;
- }
- else if (sureToQuit==0)
- {
- controlModeInput=-1;
- quitLoop=0;
- }
- }
- }
- }
- while(cookieMode==1)
- {
- alternateCookieClickNumber=cookieClickNumber*11;
- alternateCookiePower=cookiePower*2;
- scanf("%d",&cookieModeInput);
- if (cookieModeInput==cookieClickNumber)
- {
- amountOfCookies+=cookiePower;
- printf("Made %d cookies!\n", cookiePower);
- }
- else if (cookieModeInput==alternateCookieClickNumber)
- {
- 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==showControlMenu)
- {
- controlMode=1;
- cookieMode=0;
- }
- }
- 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);
- boughtSomething=1;
- 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);
- printf("\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n");
- }
- 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);
- bakerNumber++;
- cookiePower+=5;
- 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, welcome back to your cookie fabricator!\n");
- printf("\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n");
- boughtSomething=0;
- shopMode=0;
- cookieMode=1;
- }
- }
- }
- }
- printf("\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n");
- printf("Do you want to generate a save code before leaving?\n");
- scanf("%d", &generateSaveCodeBeforeExit);
- if (generateSaveCodeBeforeExit==1)
- printf("Save Code: %d %d %d\n", amountOfCookies, cursorNumber, bakerNumber);
- else
- printf("Ok then.\n");
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement