Advertisement
XOptimistixX

Cookie Clicker Alpha 0.20a

Jul 25th, 2014
218
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #include <stdio.h>
  2. #include <stdlib.h>
  3. #include <stdbool.h>
  4.  
  5. int main()
  6. {
  7.     int amountOfCookies=0, cookiePower=10, alternateCookiePower, exitIntro=0;
  8.     int cookieClickNumber=1, alternateCookieClickNumber, showCookiesNumber=2, showBoughtItems=3;
  9.     int shopAccessNumber=0, showControlMenu=100;
  10.     int showControlsNumber=1, showSaveCodeNumber=2, quitGameNumber=3;
  11.     int cookieModeInput, shopModeInput, controlModeInput=-1;
  12.     int cursorNumber=0, cursorPrice, bakerNumber=0, bakerPrice;
  13.     bool saveCode=0, printMessage=1, inGame=1, cookieMode=1, shopMode=0, controlMode=0, shopEnteredBefore=0;
  14.     bool boughtSomething=1, generateSaveCodeBeforeExit=0, sureToQuit=0, quitLoop=1;
  15.     printf("Welcome to Cookie Clicker!\nDo you have a save code?(1 for yes, 0 for no).\n");
  16.     scanf("%d", &saveCode);
  17.     if (saveCode==1)
  18.     {
  19.         printf("Load: ");
  20.         scanf("%d %d %d", &amountOfCookies, &cursorNumber, &bakerNumber);
  21.         cookiePower+=cursorNumber;
  22.         exitIntro=1;
  23.     }
  24.     else if (saveCode!=0)
  25.         printf("Please try again!");
  26.     if (exitIntro==0)
  27.     {
  28.         printf("In the beginning, you get 10 cookie each time.\nYou can buy things to help you with getting more cookies.\n");
  29.         printf("To access the controls menu, \ntype in %d anywhere during the game.\n", showControlMenu);
  30.         printf("Press 1 to continue.\n");
  31.         scanf("%d", &exitIntro);
  32.         while (exitIntro!=1)
  33.         {
  34.             printf("Please try again.\n");
  35.             scanf("%d", &exitIntro);
  36.         }
  37.  
  38.     }
  39.     while(inGame==1)
  40.     {
  41.         if (printMessage==1)
  42.         {
  43.             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");
  44.             printMessage=0;
  45.         }
  46.         while (controlMode==1)
  47.         {
  48.             quitLoop=1;
  49.             printf("Control Menu\n\n<1> Show Controls\n<2> Generate Save Code\n<3> Quit Game\n");
  50.             if (controlModeInput==-1)
  51.                 printf("\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n");
  52.             else if (controlModeInput<-1 || controlModeInput>quitGameNumber)
  53.             {
  54.                 printf("\n\n");
  55.                 printf("Unknown command");
  56.                 printf("\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n");
  57.             }
  58.             else if (controlModeInput==showControlsNumber)
  59.             {
  60.                 printf("\n\n");
  61.                 printf("Controls\n");
  62.                 printf("Click cookie: %d\n", cookieClickNumber);
  63.                 printf("Go to shop: %d\n", shopAccessNumber);
  64.                 printf("Access Control Menu: %d\n", showControlMenu);
  65.                 printf("\n\n\n\n\n\n\n\n\n\n\n\n\n");
  66.             }
  67.             else if (controlModeInput==showSaveCodeNumber)
  68.             {
  69.                 printf("\n\n");
  70.                 printf("Save Code: %d %d %d\n", amountOfCookies, cursorNumber, bakerNumber);
  71.                 printf("\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n");
  72.             }
  73.             else if (controlModeInput==0)
  74.             {
  75.                 controlMode=0;
  76.                 cookieMode=1;
  77.                 controlModeInput=-1;
  78.             }
  79.             scanf("%d", &controlModeInput);
  80.             if (controlModeInput==quitGameNumber)
  81.             {
  82.                 printf("Are you sure you want to quit the game? (1 for yes, 0 for no)\n");
  83.                 scanf("%d", &sureToQuit);
  84.                 while (quitLoop==1)
  85.                 {
  86.                     if (sureToQuit==1)
  87.                     {
  88.                         controlMode=0;
  89.                         inGame=0;
  90.                         quitLoop=0;
  91.                     }
  92.                     else if (sureToQuit==0)
  93.                     {
  94.                         controlModeInput=-1;
  95.                         quitLoop=0;
  96.                     }
  97.                 }
  98.             }
  99.         }
  100.         while(cookieMode==1)
  101.         {
  102.             alternateCookieClickNumber=cookieClickNumber*11;
  103.             alternateCookiePower=cookiePower*2;
  104.             scanf("%d",&cookieModeInput);
  105.             if (cookieModeInput==cookieClickNumber)
  106.             {
  107.                 amountOfCookies+=cookiePower;
  108.                 printf("Made %d cookies!\n", cookiePower);
  109.             }
  110.             else if (cookieModeInput==alternateCookieClickNumber)
  111.             {
  112.                 amountOfCookies+=alternateCookiePower;
  113.                 printf("Made %d cookies!\n", alternateCookiePower);
  114.             }
  115.             else if (cookieModeInput==showCookiesNumber)
  116.                 printf("Cookies: %d\n", amountOfCookies);
  117.             else if (cookieModeInput==shopAccessNumber)
  118.             {
  119.                 cookieMode=0;
  120.                 shopMode=1;
  121.             }
  122.             else if (cookieModeInput==showControlMenu)
  123.             {
  124.                 controlMode=1;
  125.                 cookieMode=0;
  126.             }
  127.         }
  128.         if (shopMode==1)
  129.         {
  130.             if (shopEnteredBefore==0)
  131.             {
  132.                 printf("Welcome to the shop!(Exit:0)\n");
  133.                 shopEnteredBefore=1;
  134.             }
  135.             else
  136.                 printf("Welcome back to the shop!\n");
  137.             while (shopMode==1)
  138.             {
  139.                 cursorPrice=500+(cursorNumber*cursorNumber*400);
  140.                 bakerPrice=1000+(cursorNumber*cursorNumber*600);
  141.                 boughtSomething=1;
  142.                 if(boughtSomething==1)
  143.                 {
  144.                     printf("Cookies: %d\n\n", amountOfCookies);
  145.                     printf("Number\t\t%-4s\t\t%-10s", "Name", "Price\t\tYou Have\tAdded CPC\n");
  146.                     printf("<1>\t\t%s(1)\t%-d\t\t%d\t\t%d\n", "Cursor", cursorPrice, cursorNumber, cursorNumber);
  147.                     printf("<2>\t\t%s(5)\t%-d\t\t%d\t\t%d\n", "Baker", bakerPrice, bakerNumber, bakerNumber*5);
  148.                     printf("\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n");
  149.                 }
  150.                 else
  151.                     printf("You only have %d cookies.\n", amountOfCookies);
  152.                 scanf("%d",&shopModeInput);
  153.                 if (shopModeInput==1)
  154.                 {
  155.                     if (amountOfCookies>=cursorPrice)
  156.                     {
  157.                         printf("You bought 1 Cursor for %d\n", cursorPrice);
  158.                         cursorNumber++;
  159.                         cookiePower++;
  160.                         amountOfCookies-=cursorPrice;
  161.                         boughtSomething=1;
  162.                     }
  163.                     else
  164.                     {
  165.                         printf("You don't have enough cookies.\n");
  166.                         boughtSomething=0;
  167.                     }
  168.                 }
  169.                 else if (shopModeInput==2)
  170.                 {
  171.                     if (amountOfCookies>=bakerPrice)
  172.                     {
  173.                         printf("You bought 1 Baker for %d\n", bakerPrice);
  174.                         cursorNumber++;
  175.                         cookiePower++;
  176.                         amountOfCookies-=bakerPrice;
  177.                         boughtSomething=1;
  178.                     }
  179.                     else
  180.                     {
  181.                         printf("You don't have enough cookies.\n");
  182.                         boughtSomething=0;
  183.                     }
  184.                 }
  185.                 else if (shopModeInput==0)
  186.                 {
  187.                     printf("You have exit the shop, welcome back to your cookie fabricator!\n");
  188.                     printf("\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n");
  189.                     boughtSomething=0;
  190.                     shopMode=0;
  191.                     cookieMode=1;
  192.                 }
  193.             }
  194.         }
  195.     }
  196.     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");
  197.     printf("Do you want to generate a save code before leaving?\n");
  198.     scanf("%d", &generateSaveCodeBeforeExit);
  199.     if (generateSaveCodeBeforeExit==1)
  200.         printf("Save Code: %d %d %d\n", amountOfCookies, cursorNumber, bakerNumber);
  201.     else
  202.         printf("Ok then.\n");
  203.     return 0;
  204. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement