SHOW:
|
|
- or go back to the newest paste.
1 | #include <stdio.h> | |
2 | #include <stdlib.h> | |
3 | #include <stdbool.h> | |
4 | ||
5 | int main() | |
6 | { | |
7 | - | int amountOfCookies=0, cookiePower=10, alternateCookiePower=cookiePower*2; |
7 | + | int amountOfCookies=0, cookiePower=10, alternateCookiePower; |
8 | - | int cookieInputNumber=1, alternateCookieInputNumber=cookieInputNumber*11, shopAccessNumber=0; |
8 | + | int cookieInputNumber=1, alternateCookieInputNumber, shopAccessNumber=0; |
9 | int showCookiesNumber=2, changeControlsNumber=101, showControlsNumber=100, quitGameNumber=69; | |
10 | int cookieModeInput, shopModeInput; | |
11 | int cursorNumber=0, cursorPrice=500; | |
12 | - | bool changeControls=1, defaultControls=1, keepControls=0, correctControls=0, quitGame=0, cookieMode=1, shopMode=0, shopEnteredBefore=0; |
12 | + | bool saveCode, intro=1, changeControls=0, defaultControls=1, keepControls=0, correctControls=0, quitGame=0, cookieMode=1, shopMode=0, shopEnteredBefore=0; |
13 | - | printf("Welcome to Cookie Clicker!\n"); |
13 | + | printf("Welcome to Cookie Clicker!\nDo you have a save code?(1 for yes, 0 for no)."); |
14 | - | printf("In the beginning, you get 1 cookie each time.\nYou can buy things to help you with getting more cookies.\n"); |
14 | + | scanf("%d", &saveCode); |
15 | - | printf("In case you want to other controls, \ntype in %d anywhere during the game.\n", showControlsNumber); |
15 | + | if (saveCode==1) |
16 | - | printf("Do you wish to change the default controls?(1 for yes, 0 for no)\n"); |
16 | + | |
17 | - | scanf("%d", &changeControls); |
17 | + | intro=0; |
18 | - | if (changeControls==0) |
18 | + | scanf("%d %d %d %d", &amountOfCookies, &cookiePower, &cursorNumber, &cursorPrice); |
19 | - | printf("To click a cookie, use %d\nTo go to the shop, use %d\n", cookieInputNumber, shopAccessNumber); |
19 | + | |
20 | - | while (quitGame==0) |
20 | + | else if (saveCode!=0) |
21 | printf("Please try again!"); | |
22 | - | while (changeControls==1) |
22 | + | if (intro==1) |
23 | { | |
24 | - | printf("What number do you want to use to click the cookies?(default \"%d\")\n",cookieInputNumber); |
24 | + | printf("In the beginning, you get 1 cookie each time.\nYou can buy things to help you with getting more cookies.\n"); |
25 | - | scanf("%d",&cookieInputNumber); |
25 | + | printf("In case you want to other controls, \ntype in %d anywhere during the game.\n", showControlsNumber); |
26 | - | printf("What number for shop?(default \"%d\")\n", shopAccessNumber); |
26 | + | printf("Do you wish to change the default controls?(1 for yes, 0 for no)\n"); |
27 | - | scanf("%d",&shopAccessNumber); |
27 | + | scanf("%d", &changeControls); |
28 | - | if (shopAccessNumber!=cookieInputNumber) |
28 | + | if (changeControls==0) |
29 | - | correctControls=1; |
29 | + | |
30 | - | while (correctControls==0) |
30 | + | printf("To click a cookie, use %d\nTo go to the shop, use %d\n", cookieInputNumber, shopAccessNumber); |
31 | intro=0; | |
32 | - | printf("You can't do that. Please try again"); |
32 | + | |
33 | - | scanf("%d", &shopAccessNumber); |
33 | + | |
34 | while (quitGame==0) | |
35 | { | |
36 | while (changeControls==1) | |
37 | - | printf("What number do you want to use to show\nthe amount of cookies you have at anytime(default \"%d\")?\n", showCookiesNumber); |
37 | + | |
38 | - | scanf("%d", &showCookiesNumber); |
38 | + | printf("What number do you want to use to click the cookies?(default \"%d\")\n",cookieInputNumber); |
39 | - | printf("Do you want to keep these controls?(1 for yes, 0 for no)\n"); |
39 | + | scanf("%d",&cookieInputNumber); |
40 | - | scanf("%d", &keepControls); |
40 | + | printf("What number for shop?(default \"%d\")\n", shopAccessNumber); |
41 | - | changeControls=!keepControls; |
41 | + | scanf("%d",&shopAccessNumber); |
42 | if (shopAccessNumber!=cookieInputNumber) | |
43 | correctControls=1; | |
44 | while (correctControls==0) | |
45 | { | |
46 | printf("You can't do that. Please try again"); | |
47 | scanf("%d", &shopAccessNumber); | |
48 | if (shopAccessNumber!=cookieInputNumber) | |
49 | correctControls=1; | |
50 | } | |
51 | printf("What number do you want to use to show\nthe amount of cookies you have at anytime(default \"%d\")?\n", showCookiesNumber); | |
52 | scanf("%d", &showCookiesNumber); | |
53 | printf("Do you want to keep these controls?(1 for yes, 0 for no)\n"); | |
54 | scanf("%d", &keepControls); | |
55 | changeControls=!keepControls; | |
56 | } | |
57 | printf("Start collecting cookies!\n"); | |
58 | alternateCookieInputNumber=cookieInputNumber*11; | |
59 | alternateCookiePower=cookiePower*2; | |
60 | while(quitGame==0) | |
61 | { | |
62 | while(cookieMode==1) | |
63 | { | |
64 | scanf("%d",&cookieModeInput); | |
65 | if (cookieModeInput==cookieInputNumber) | |
66 | { | |
67 | amountOfCookies+=cookiePower; | |
68 | if (cookiePower==1) | |
69 | printf("Made %d cookie!\n", cookiePower); | |
70 | else | |
71 | printf("Made %d cookies!\n", cookiePower); | |
72 | } | |
73 | else if (cookieModeInput==alternateCookieInputNumber) | |
74 | { | |
75 | amountOfCookies+=alternateCookiePower; | |
76 | printf("Made %d cookies!\n", alternateCookiePower); | |
77 | } | |
78 | else if (cookieModeInput==showCookiesNumber) | |
79 | printf("Cookies: %d\n", amountOfCookies); | |
80 | else if (cookieModeInput==shopAccessNumber) | |
81 | { | |
82 | cookieMode=0; | |
83 | shopMode=1; | |
84 | } | |
85 | else if (cookieModeInput==changeControlsNumber) | |
86 | { | |
87 | changeControls=1; | |
88 | cookieMode=0; | |
89 | } | |
90 | else if (cookieModeInput==quitGameNumber) | |
91 | { | |
92 | cookieMode=0; | |
93 | quitGame=1; | |
94 | } | |
95 | else if (cookieModeInput==showControlsNumber) | |
96 | { | |
97 | printf("To click cookies: %d\nTo show amount of cookies: %d\n", cookieInputNumber, showCookiesNumber); | |
98 | printf("To go to the shop: %d\nTo change controls: %d\n", shopAccessNumber, changeControlsNumber); | |
99 | printf("To show controls again: %d\nTo quit the game: %d\n", showControlsNumber, quitGameNumber); | |
100 | printf("Got it? Ok resume collecting cookies!\n"); | |
101 | } | |
102 | } | |
103 | if (shopMode==1) | |
104 | { | |
105 | if (shopEnteredBefore==0) | |
106 | { | |
107 | printf("Welcome to the shop, press 0 to exit.\n"); | |
108 | shopEnteredBefore=1; | |
109 | } | |
110 | else | |
111 | printf("Welcome back to the shop!\n"); | |
112 | printf("You have %d cookies.\n", amountOfCookies); | |
113 | printf("<1>Cursor: %d cookies [%d]\n", cursorPrice, cursorNumber); | |
114 | while (shopMode==1) | |
115 | { | |
116 | scanf("%d",&shopModeInput); | |
117 | if (shopModeInput==1) | |
118 | { | |
119 | if (amountOfCookies>=cursorPrice) | |
120 | { | |
121 | printf("You bought 1 Cursor for %d\n", cursorPrice); | |
122 | cursorNumber++; | |
123 | cursorPrice+=100+(cursorNumber*cursorNumber*400); | |
124 | } | |
125 | else | |
126 | { | |
127 | printf("You don't have enough cookies.\n"); | |
128 | } | |
129 | } | |
130 | else if (shopModeInput==0) | |
131 | { | |
132 | printf("You have exit the shop."); | |
133 | shopMode=0; | |
134 | cookieMode=1; | |
135 | } | |
136 | } | |
137 | } | |
138 | } | |
139 | printf("Keep this safe code.") | |
140 | printf("%d %d %d %d", amountOfCookies, cookiePower, cursorNumber, cursorPrice); | |
141 | } | |
142 | return 0; | |
143 | } |