-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathscript.js
More file actions
120 lines (115 loc) · 5.07 KB
/
script.js
File metadata and controls
120 lines (115 loc) · 5.07 KB
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
/*global $*/
var YES_STATE = 0;
var PRETEND_STATE = 1;
var FIGHT_STATE =2;
var PANIC_STATE=3;
var RESTART_STATE=100;
var STRUGGLE_STATE=4;
var SECURE_STATE=5;
var TURN_STATE=6;
var CAUGHT_STATE=7;
var STAIR_STATE=8;
var PRETEND_STATE2=9;
var START=2;
var programState= YES_STATE;
function blinker() {
$('.fpage').hide(16);
$('.fpage').show(15.5);
}
setInterval(blinker, 1000);
function blinkerTwo() {
$('#title').hide(14);
$('#title').show(15);
}
setInterval(blinkerTwo, 1000);
$(".choiceOne").click(function(){
if(programState===YES_STATE){
$("#choices").append("You chose to sleep");
nextLevel("Pretend To Be Unconscious","Fight","When you wake up, You realize being dragged away what do you do?");
programState = PRETEND_STATE;
}else if(programState===PRETEND_STATE){
$("#choices").append("<br> You chose to pretend to be knocked out");
nextLevel("Continuing Pretending","Fight","You are still being dragged away what do you do?");
programState=PRETEND_STATE2;
}else if(programState===PRETEND_STATE2){
$("#choices").append("<br>You chose to continue pretending, you are dragged away never to be seen again.");
GameOver("Game Over");
}else if(programState===RESTART_STATE){
$("#choices").empty();
$(".choiceTwo").show();
nextLevel("Yes","No","You are home alone and tired. Do you go to sleep?");
programState = YES_STATE;
}else if(programState===PANIC_STATE){
$("#choices").append("<br> You chose to run left, There is a masked figure, they knock you out");
nextLevel("Struggle","Stay Silent","You wake up tied to a chair");
programState=STRUGGLE_STATE;
}else if(programState===STRUGGLE_STATE){
$("#choices").append("<br> You chose to struggle. You got one arm free");
nextLevel("Continue Struggle","Pretend to be secure","The kidnapper is here.");
programState=SECURE_STATE;
}else if(programState===SECURE_STATE){
$("#choices").append("<br> You startled the kidnapper, they knock you out");
GameOver("Game Over");
}else if(programState===TURN_STATE){
$("#choices").append("<br> You turned into the kidnapper's weapon. ");
GameOver("Game Over");
}else if(programState===CAUGHT_STATE){
$("#choices").append("<br> You chose to struggle and got free");
nextLevel("Upstairs","Downstairs","You've reached a set of stairs");
programState = STAIR_STATE;
}else if(programState===STAIR_STATE){
$("#choices").append("<br> You chose to go upstairs and have backed yourself into a corner");
GameOver("????");
}
});
$(".choiceTwo").click(function(){
if(programState===YES_STATE){
$("#choices").append("You chose not to sleep but fell out anyways");
nextLevel("Pretend To Be Unconscious","Fight","When you wake up, You're being dragged away what do you do?");
programState = PRETEND_STATE;
}else if(programState===PRETEND_STATE||programState===PRETEND_STATE2){
$("#choices").append("<br> You chose to fight the kidnapper");
nextLevel("Go left","Go right","You're running from danger, what direction should you go?");
programState=PANIC_STATE;
}else if(programState===PANIC_STATE){
$("#choices").append("<br> You chose to run right");
nextLevel("Turn Back","Push Forward","You see a figure in the distance");
programState=TURN_STATE;
}else if(programState===STRUGGLE_STATE){
$("#choices").append("<br> You chose to stay silent. The kidnapper's face is the last thing you ever see");
GameOver("Game Over");
}
else if(programState===SECURE_STATE){
$("#choices").append("<br> You chose to wait until the coast was clear to make your escape");
nextLevel("Go left","Go right","You're running from danger, what direction should you go?");
programState=PANIC_STATE;
}
else if(programState===TURN_STATE){
$("#choices").append("<br> You chose to push forward");
nextLevel("Struggle","Submit","The kidnapper has you!");
programState=CAUGHT_STATE;
}else if(programState===CAUGHT_STATE){
$("#choices").append("<br> You couldn't fight them off and choose to give up");
nextLevel("Struggle","Stay Silent","You wake up tied to a chair");
programState=STRUGGLE_STATE;
}else if(programState===STAIR_STATE){
$("#choices").append("<br> You chose to go downstairs, you make it to the outside. You're free but its never really over");
GameOver("The best ending you can get");
programState=RESTART_STATE;
}
});
function GameOver(x){
$("#story").hide();
$("#caption").text(x);
$(".choiceOne").text("Restart");
setTimeout(function(){$("#story").show(); }, 1000);
$(".choiceTwo").hide();
programState=RESTART_STATE;
}
function nextLevel(text1,text2,text3){
$("#story").hide();
$(".choiceOne").text(text1);
$(".choiceTwo").text(text2);
$("#caption").text(text3);
setTimeout(function(){$("#story").show(); }, 1000);
}