-
Notifications
You must be signed in to change notification settings - Fork 0
/
banandersnatch.js
313 lines (289 loc) · 16.6 KB
/
banandersnatch.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
var spot = 0;
var playerName;
var response = "";
var firstTime = true;
var hasBanana = false;
function update() {
if (document.getElementById("response").value.toUpperCase().localeCompare("")) {
if (playerName == null) {
if (!document.getElementById("response").value.toUpperCase().localeCompare("APE")) {
playerName = "Marc";
} else if (!document.getElementById("response").value.toUpperCase().localeCompare("GIVE MIKE AN INTERNSHIP")) {
console.log("correct");
kingEnding();
return;
} else {
playerName = document.getElementById("response").value;
}
document.getElementById("mainTitleLabel").innerText = ("Banandersnatch - " + playerName);
document.getElementById("response").value = "";
spot++;
firstEvent();
} else {
response = document.getElementById("response").value;
document.getElementById("response").value = "";
}
console.log(response)
if (spot == 1 && !firstTime) {
if (!response.toUpperCase().localeCompare("RUN")) {
gameOver("You try and outrun the creature, but you make too much noise and alert the creature who chases you down and captures you.");
} else if (!response.toUpperCase().localeCompare("TURN AROUND")) {
spot += 1;
secondEvent();
} else if (!response.toUpperCase().localeCompare("CLIMB TREE")) {
spot += 100;
secondEventAlt();
} else {
document.getElementById("response").value = "Please enter a valid input";
}
} else if (spot == 2) {
if (!response.localeCompare("RUN")) {
gameOver("You try and outrun the creature, but you the APE chases you down and captures you.");
} else if (!response.toUpperCase().localeCompare("FIGHT")) {
spot += 1;
thirdEvent();
} else {
document.getElementById("response").value = "Please enter a valid input";
}
} else if (spot == 101) {
if (!response.toUpperCase().localeCompare("TAKE BANANA")) {
spot = 123123;
getBanana();
} else if (!response.toUpperCase().localeCompare("STAY QUIET")) {
spot += 1;
thirdEventAlt();
} else {
document.getElementById("response").value = "Please enter a valid input";
}
} else if (spot == 3) {
if (!response.toUpperCase().localeCompare("FOLLOW")) {
spot = 50;
secondHalfIntro();
} else if (!response.toUpperCase().localeCompare("DON'T FOLLOW")) {
spot++;
thirdEventSneak();
} else {
document.getElementById("response").value = "Please enter a valid input";
}
} else if (spot == 4) {
var num = parseInt(response);
var answer = Math.floor((Math.random() * 10) + 1);
if (num == answer) {
escapeEnding();
} else {
gameOver("The APE's keen hearing detects your escape and is offended, he hunts you down and captures you");
}
} else if (spot == 123123) {
if (!response.toUpperCase().localeCompare("CONTINUE")) {
spot = 102;
thirdEventAlt();
} else {
document.getElementById("response").value = "Please enter a valid input";
}
} else if (spot == 102) {
if (!response.toUpperCase().localeCompare("RUN")) {
gameOver("You try and outrun the creature, but you the APE chases you down and captures you.");
} else if (!response.toUpperCase().localeCompare("FIGHT")) {
spot = 3;
thirdEvent();
} else {
document.getElementById("response").value = "Please enter a valid input";
}
} else if (spot == 50) {
if (!response.toUpperCase().localeCompare("LEFT")) {
spot += 1;
lookLeft();
} else if (!response.toUpperCase().localeCompare("RIGHT")) {
spot += 2;
lookRight();
} else {
document.getElementById("response").value = "Please enter a valid input";
}
} else if (spot == 51 || spot == 52) {
if (!response.toUpperCase().localeCompare("CONTINUE")) {
spot = 53;
meetKing();
} else {
document.getElementById("response").value = "Please enter a valid input";
}
} else if (spot == 53) {
if (!response.toUpperCase().localeCompare("BOW")) {
spot = 54;
fightChampionApe();
} else if (!response.toUpperCase().localeCompare("TRY TO COMMUNICATE")) {
gameOver("You make APE noise in an attempt to communicate, but the king speaks perfect english and is greatly offended, you're sentenced to life in prison");
} else {
document.getElementById("response").value = "Please enter a valid input";
}
} else if (spot == 54) {
if (!response.toUpperCase().localeCompare("CONTINUE")) {
spot = 55;
actualFight();
} else {
document.getElementById("response").value = "Please enter a valid input";
}
} else if (spot == 55) {
if (!response.toUpperCase().localeCompare("ROCK")) {
gameOver("The ape chose paper, for failing the challenge you are sentenced to life in prison");
} else if (!response.toUpperCase().localeCompare("PAPER")) {
spot = 56;
winFight();
} else if (!response.toUpperCase().localeCompare("SCISSORS")) {
gameOver("The ape chose rock, for failing the challenge you are sentenced to life in prison");
} else {
document.getElementById("response").value = "Please enter a valid input";
}
} else if (spot == 56) {
if (!response.toUpperCase().localeCompare("CONTINUE")) {
spot = 57;
kingOffer();
} else {
document.getElementById("response").value = "Please enter a valid input";
}
} else if (spot == 57) {
if (!response.toUpperCase().localeCompare("ACCEPT")) {
championEnding();
} else if (!response.toUpperCase().localeCompare("CHALLENGE KING APE")) {
spot = 58;
challengeKing();
} else if (!response.toUpperCase().localeCompare("DECLINE")) {
gameOver("The King APE is offended by your refusal, you have been sentenced to life in prison");
} else {
document.getElementById("response").value = "Please enter a valid input";
}
} else if (spot == 58) {
if (!response.toUpperCase().localeCompare("ROCK")) {
gameOver("The King APE chose paper, you are sentenced to life in prison");
} else if (!response.toUpperCase().localeCompare("PAPER")) {
gameOver("The King APE chose scissors, you are sentenced to life in prison");
} else if (!response.toUpperCase().localeCompare("SCISSORS")) {
gameOver("The King APE chose rock, you are sentenced to life in prison");
} else if (!response.toUpperCase().localeCompare("BANANA") && hasBanana) {
spot = 1000;
beatKing();
} else {
document.getElementById("response").value = "Please enter a valid input";
}
} else if (spot == 1000) {
if (!response.toUpperCase().localeCompare("CONTINUE")) {
kingEnding();
} else {
responseField.setText("Please enter a valid input");
}
} else if (firstTime) {
firstTime = false;
}
} else {
document.getElementById("response").value = "Please enter a valid input";
}
}
function firstEvent() {
document.getElementById("image").src="http://blogs.discovermagazine.com/d-brief/files/2017/08/shutterstock_244338682.jpg";
document.getElementById("prompt").innerText = "You're alone on an expedition in the Amazon Jungle and you hear a rustle behind you";
document.getElementById("prompt2").innerText = "What do you do? (run, turn around, climb tree)";
}
function secondEvent() {
document.getElementById("image").src="https://c1.staticflickr.com/5/4075/4740022283_f1f2329b53_b.jpg";
document.getElementById("prompt").innerText = "You turn around and see an enourmous APE staring down at you";
document.getElementById("prompt2").innerText = "What do you do? (run, fight)";
}
function secondEventAlt() {
document.getElementById("image").src="https://images.fineartamerica.com/images/artworkimages/mediumlarge/2/you-big-ape-robert-frank-gabriel.jpg";
document.getElementById("prompt").innerText = "You climb the tree, you see a massive ape below. There are also bananas in your tree";
document.getElementById("prompt2").innerText = "What do you do? (take banana, stay quiet)";
}
function thirdEvent() {
document.getElementById("image").src="https://www.sciencedaily.com/images/2007/08/070802091437_1_900x600.jpg";
document.getElementById("prompt").innerText = "The APE respects your fighting spirit and motions for you to follow";
document.getElementById("prompt2").innerText = "What do you do? (follow, don't follow)";
}
function getBanana() {
hasBanana = true;
document.getElementById("image").src="https://images-na.ssl-images-amazon.com/images/I/71gI-IUNUkL._SY355_.jpg";
document.getElementById("prompt").innerText = "You now have a banana";
document.getElementById("prompt2").innerText = "Type 'continue' to continue";
}
function thirdEventAlt() {
document.getElementById("image").src="https://c1.staticflickr.com/5/4075/4740022283_f1f2329b53_b.jpg";
document.getElementById("prompt").innerText = "You climb down once you think it's safe, but turn to see an enourmous APE staring";
document.getElementById("prompt2").innerText = "down at you. What do you do? (run, fight)";
}
function thirdEventSneak() {
document.getElementById("prompt").innerText = "You try to sneak away while the APE's not looking";
document.getElementById("prompt2").innerText = "Pick a number between 1 and 10 [inclusive]";
}
// SECOND HALF OF BANANDERSNATCH
function secondHalfIntro() {
document.getElementById("image").src="https://www.ancient-origins.net/sites/default/files/field/image/lost-city-of-gold.JPG";
document.getElementById("prompt").innerText = "You follow the APE. He brings you to the lost city of APElantis. You take a look";
document.getElementById("prompt2").innerText = "around. Which way do you look? (left, right)";
}
function lookLeft() {
document.getElementById("image").src="http://rotocasted.com/static/mediafiles/tmpirUbaL.jpg.580x580_q85.jpg";
document.getElementById("prompt").innerText = "You look left and see a 50ft gold statue of an ape wearing a crown. Looks like some";
document.getElementById("prompt2").innerText = "sort of king. Type 'continue' to continue";
}
function lookRight() {
document.getElementById("image").src="http://theculturalgutter.com/wp-content/uploads/2012/07/pota-magno.jpg";
document.getElementById("prompt").innerText = "You look right and see thousands of APEs, marketplaces, and homes. It contains";
document.getElementById("prompt2").innerText = "technology you can't even fathom. Type 'continue' to continue";
}
function meetKing() {
document.getElementById("image").src="https://res.cloudinary.com/teepublic/image/private/s--S3Net-__--/t_Preview/b_rgb:191919,c_limit,f_jpg,h_630,q_90,w_630/v1534188776/production/designs/3016141_0.jpg";
document.getElementById("prompt").innerText = "You are brought into a palace of sorts. In it you are met with the King APE";
document.getElementById("prompt2").innerText = "What do you do? (bow, try to communicate)";
}
function fightChampionApe() {
document.getElementById("image").src="https://res.cloudinary.com/teepublic/image/private/s--S3Net-__--/t_Preview/b_rgb:191919,c_limit,f_jpg,h_630,q_90,w_630/v1534188776/production/designs/3016141_0.jpg";
document.getElementById("prompt").innerText = "You bow before the King APE, who declares that you must prove yourself by fighting";
document.getElementById("prompt2").innerText = "the APE Champion. Type 'continue' to continue";
}
function actualFight() {
document.getElementById("image").src="https://vignette.wikia.nocookie.net/planetoftheapes/images/f/fd/1396985361008-09-ss036-0180-v157-le1077.jpg/revision/latest?cb=20140409125015";
document.getElementById("prompt").innerText = "The Champion APE comes out from the shadows, he is 15ft tall and RIPPED.";
document.getElementById("prompt2").innerText = "Choose your weapon (rock, paper, scissors)";
}
function winFight() {
document.getElementById("image").src="https://res.cloudinary.com/teepublic/image/private/s--5cPQH0NH--/t_Resized%20Artwork/c_fit,g_north_west,h_954,w_954/co_ffffff,e_outline:48/co_ffffff,e_outline:inner_fill:48/co_ffffff,e_outline:48/co_ffffff,e_outline:inner_fill:48/co_bbbbbb,e_outline:3:1000/c_mpad,g_center,h_1260,w_1260/b_rgb:eeeeee/c_limit,f_jpg,h_630,q_90,w_630/v1503238736/production/designs/1837630_0.jpg";
document.getElementById("prompt").innerText = "Your paper beats the Champion APE's rock, you have won!";
document.getElementById("prompt2").innerText = "Type 'continue' to continue";
}
function kingOffer() {
document.getElementById("image").src="https://res.cloudinary.com/teepublic/image/private/s--S3Net-__--/t_Preview/b_rgb:191919,c_limit,f_jpg,h_630,q_90,w_630/v1534188776/production/designs/3016141_0.jpg";
document.getElementById("prompt").innerText = "The King APE is impressed and offers to make you the new Champion APE";
document.getElementById("prompt2").innerText = "What do you do? (accept, decline, challenge King APE)";
}
function challengeKing() {
document.getElementById("image").src="https://f4.bcbits.com/img/0006163982_10.jpg";
document.getElementById("prompt").innerText = "The King APE accepts your challenge";
document.getElementById("prompt2").innerText = "Choose your weapon (rock, paper, scissors)";
}
function beatKing() {
document.getElementById("image").src="https://f4.bcbits.com/img/0006163982_10.jpg";
document.getElementById("prompt").innerText = "You take out the banana as the King APE throws scissors. All APEs are momentarily";
document.getElementById("prompt2").innerText = "distracted as you switch your hand to rock, you win! Type 'continue' to continue";
}
function gameOver(message) {
document.getElementById("submit").disabled = true;
document.getElementById("image").src="https://d2v9y0dukr6mq2.cloudfront.net/video/thumbnail/2T0t-6V/videoblocks-game-over-8-bit-funky-a-funky-colorful-4k-game-over-screen-animation-letters-falling-towards-the-center-8-bit-retro-style-red-and-yellow_hcqx9_kax_thumbnail-full06.png";
document.getElementById("prompt").innerText = message;
document.getElementById("prompt2").innerText = "Refresh the page to try again";
}
function escapeEnding() {
document.getElementById("submit").disabled = true;
document.getElementById("image").src="https://blog.radissonblu.com/wp-content/uploads/2014/11/escape-room.jpg";
document.getElementById("prompt").innerText = "ENDING #1";
document.getElementById("prompt2").innerText = "You successfully escaped the APE, but you feel as if you've missed a great adventure";
}
function championEnding() {
document.getElementById("submit").disabled = true;
document.getElementById("image").src="https://img.wondercostumes.com/imgzoom/babealonian-warrior-man-68630.jpg";
document.getElementById("prompt").innerText = "ENDING #2";
document.getElementById("prompt2").innerText = "Congrats you are now the Champion APE!!";
}
function kingEnding() {
document.getElementById("submit").disabled = true;
document.getElementById("image").src="https://yt3.ggpht.com/a-/AAuE7mD5AkH2PbSMcp4Z8CJg0EM22PvjuPzvdrOA3Q=s900-mo-c-c0xffffffff-rj-k-no";
document.getElementById("prompt").innerText = "ENDING #3";
document.getElementById("prompt2").innerText = "You have become the King APE. You are now a God among APEs";
}