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; | |
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; |
11 | + | int cursorNumber=0, cursorPrice, bakerNumber=0, bakerPrice; |
12 | - | bool saveCode, intro=1, changeControls=0, defaultControls=1, keepControls=0, correctControls=0, quitGame=0, cookieMode=1, shopMode=0, shopEnteredBefore=0; |
12 | + | 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;; |
13 | - | printf("Welcome to Cookie Clicker!\nDo you have a save code?(1 for yes, 0 for no)."); |
13 | + | printf("Welcome to Cookie Clicker!\nDo you have a save code?(1 for yes, 0 for no).\n"); |
14 | scanf("%d", &saveCode); | |
15 | if (saveCode==1) | |
16 | { | |
17 | intro=0; | |
18 | - | scanf("%d %d %d %d", &amountOfCookies, &cookiePower, &cursorNumber, &cursorPrice); |
18 | + | scanf("%d %d %d", &amountOfCookies, &cursorNumber, &bakerNumber); |
19 | cookiePower+=cursorNumber; | |
20 | } | |
21 | - | printf("Please try again!"); |
21 | + | |
22 | printf("Please try again!"); | |
23 | if (intro==1) | |
24 | { | |
25 | printf("In the beginning, you get 1 cookie each time.\nYou can buy things to help you with getting more cookies.\n"); | |
26 | printf("In case you want to other controls, \ntype in %d anywhere during the game.\n", showControlsNumber); | |
27 | printf("Do you wish to change the default controls?(1 for yes, 0 for no)\n"); | |
28 | scanf("%d", &changeControls); | |
29 | if (changeControls==0) | |
30 | - | printf("To click a cookie, use %d\nTo go to the shop, use %d\n", cookieInputNumber, shopAccessNumber); |
30 | + | |
31 | 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); | |
32 | intro=0; | |
33 | } | |
34 | - | while (quitGame==0) |
34 | + | |
35 | while (quitGame==0) | |
36 | - | while (changeControls==1) |
36 | + | |
37 | while (changeControls==1) | |
38 | - | printf("What number do you want to use to click the cookies?(default \"%d\")\n",cookieInputNumber); |
38 | + | |
39 | - | scanf("%d",&cookieInputNumber); |
39 | + | printf("What number do you want to use to click the cookies?(default \"%d\")\n",cookieInputNumber); |
40 | - | printf("What number for shop?(default \"%d\")\n", shopAccessNumber); |
40 | + | scanf("%d",&cookieInputNumber); |
41 | - | scanf("%d",&shopAccessNumber); |
41 | + | printf("What number for shop?(default \"%d\")\n", shopAccessNumber); |
42 | - | if (shopAccessNumber!=cookieInputNumber) |
42 | + | scanf("%d",&shopAccessNumber); |
43 | - | correctControls=1; |
43 | + | if (shopAccessNumber!=cookieInputNumber) |
44 | - | while (correctControls==0) |
44 | + | correctControls=1; |
45 | while (correctControls==0) | |
46 | - | printf("You can't do that. Please try again"); |
46 | + | |
47 | - | scanf("%d", &shopAccessNumber); |
47 | + | printf("You can't do that. Please try again"); |
48 | - | if (shopAccessNumber!=cookieInputNumber) |
48 | + | scanf("%d", &shopAccessNumber); |
49 | - | correctControls=1; |
49 | + | if (shopAccessNumber!=cookieInputNumber) |
50 | correctControls=1; | |
51 | - | printf("What number do you want to use to show\nthe amount of cookies you have at anytime(default \"%d\")?\n", showCookiesNumber); |
51 | + | |
52 | - | scanf("%d", &showCookiesNumber); |
52 | + | printf("What number do you want to use to show\nthe amount of cookies you have at anytime(default \"%d\")?\n", showCookiesNumber); |
53 | - | printf("Do you want to keep these controls?(1 for yes, 0 for no)\n"); |
53 | + | scanf("%d", &showCookiesNumber); |
54 | - | scanf("%d", &keepControls); |
54 | + | printf("Do you want to keep these controls?(1 for yes, 0 for no)\n"); |
55 | - | changeControls=!keepControls; |
55 | + | scanf("%d", &keepControls); |
56 | changeControls=!keepControls; | |
57 | - | printf("Start collecting cookies!\n"); |
57 | + | |
58 | inGame=1; | |
59 | - | alternateCookiePower=cookiePower*2; |
59 | + | printf("\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n"); |
60 | - | while(quitGame==0) |
60 | + | |
61 | if (firstTimeAtIntro==1) | |
62 | { | |
63 | 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"); | |
64 | firstTimeAtIntro=0; | |
65 | } | |
66 | else | |
67 | 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"); | |
68 | alternateCookieInputNumber=cookieInputNumber*11; | |
69 | - | printf("Made %d cookie!\n", cookiePower); |
69 | + | while(inGame==1) |
70 | { | |
71 | - | printf("Made %d cookies!\n", cookiePower); |
71 | + | |
72 | { | |
73 | if (shopEnteredBefore==1) | |
74 | printf("Welcome back to your cookie fabricator!\n"); | |
75 | alternateCookiePower=cookiePower*2; | |
76 | scanf("%d",&cookieModeInput); | |
77 | if (cookieModeInput==cookieInputNumber) | |
78 | { | |
79 | amountOfCookies+=cookiePower; | |
80 | if (cookiePower==1) | |
81 | printf("Made %d cookie!\n", cookiePower); | |
82 | else | |
83 | printf("Made %d cookies!\n", cookiePower); | |
84 | } | |
85 | else if (cookieModeInput==alternateCookieInputNumber) | |
86 | { | |
87 | amountOfCookies+=alternateCookiePower; | |
88 | printf("Made %d cookies!\n", alternateCookiePower); | |
89 | } | |
90 | else if (cookieModeInput==showCookiesNumber) | |
91 | printf("Cookies: %d\n", amountOfCookies); | |
92 | else if (cookieModeInput==shopAccessNumber) | |
93 | { | |
94 | cookieMode=0; | |
95 | shopMode=1; | |
96 | } | |
97 | else if (cookieModeInput==changeControlsNumber) | |
98 | { | |
99 | changeControls=1; | |
100 | cookieMode=0; | |
101 | inGame=0; | |
102 | } | |
103 | else if (cookieModeInput==quitGameNumber) | |
104 | { | |
105 | cookieMode=0; | |
106 | inGame=0; | |
107 | - | printf("Welcome to the shop, press 0 to exit.\n"); |
107 | + | |
108 | } | |
109 | else if (cookieModeInput==showControlsNumber) | |
110 | { | |
111 | printf("To click cookies: %d\nTo show amount of cookies: %d\n", cookieInputNumber, showCookiesNumber); | |
112 | - | printf("You have %d cookies.\n", amountOfCookies); |
112 | + | |
113 | - | printf("<1>Cursor: %d cookies [%d]\n", cursorPrice, cursorNumber); |
113 | + | |
114 | printf("Got it? Ok resume collecting cookies!\n"); | |
115 | } | |
116 | } | |
117 | if (shopMode==1) | |
118 | { | |
119 | if (shopEnteredBefore==0) | |
120 | { | |
121 | printf("Welcome to the shop!(Exit:0)\n"); | |
122 | shopEnteredBefore=1; | |
123 | - | cursorPrice+=100+(cursorNumber*cursorNumber*400); |
123 | + | |
124 | else | |
125 | printf("Welcome back to the shop!\n"); | |
126 | while (shopMode==1) | |
127 | { | |
128 | cursorPrice=500+(cursorNumber*cursorNumber*400); | |
129 | bakerPrice=1000+(cursorNumber*cursorNumber*600); | |
130 | if (boughtSomething==1) | |
131 | { | |
132 | - | printf("You have exit the shop."); |
132 | + | printf("Cookies: %d\n\n", amountOfCookies); |
133 | printf("Number\t\t%-4s\t\t%-10s", "Name", "Price\t\tYou Have\tAdded CPC\n"); | |
134 | printf("<1>\t\t%s(1)\t%-d\t\t%d\t\t%d\n", "Cursor", cursorPrice, cursorNumber, cursorNumber); | |
135 | printf("<2>\t\t%s(5)\t%-d\t\t%d\t\t%d\n", "Baker", bakerPrice, bakerNumber, bakerNumber*5); | |
136 | } | |
137 | else | |
138 | printf("You only have %d cookies.\n", amountOfCookies); | |
139 | - | printf("Keep this safe code.") |
139 | + | |
140 | - | printf("%d %d %d %d", amountOfCookies, cookiePower, cursorNumber, cursorPrice); |
140 | + | |
141 | { | |
142 | - | return 0; |
142 | + | |
143 | { | |
144 | printf("You bought 1 Cursor for %d\n", cursorPrice); | |
145 | cursorNumber++; | |
146 | cookiePower++; | |
147 | amountOfCookies-=cursorPrice; | |
148 | boughtSomething=1; | |
149 | } | |
150 | else | |
151 | { | |
152 | printf("You don't have enough cookies.\n"); | |
153 | boughtSomething=0; | |
154 | } | |
155 | } | |
156 | else if (shopModeInput==2) | |
157 | { | |
158 | if (amountOfCookies>=bakerPrice) | |
159 | { | |
160 | printf("You bought 1 Baker for %d\n", bakerPrice); | |
161 | cursorNumber++; | |
162 | cookiePower++; | |
163 | amountOfCookies-=bakerPrice; | |
164 | boughtSomething=1; | |
165 | } | |
166 | else | |
167 | { | |
168 | printf("You don't have enough cookies.\n"); | |
169 | boughtSomething=0; | |
170 | } | |
171 | } | |
172 | else if (shopModeInput==0) | |
173 | { | |
174 | printf("You have exit the shop.\n"); | |
175 | shopMode=0; | |
176 | cookieMode=1; | |
177 | } | |
178 | } | |
179 | } | |
180 | } | |
181 | } | |
182 | printf("Keep this code safe.\n"); | |
183 | printf("%d %d %d\n", amountOfCookies, cursorNumber, bakerNumber); | |
184 | return 0; | |
185 | } |