-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathscript.js
More file actions
216 lines (153 loc) · 4.58 KB
/
Copy pathscript.js
File metadata and controls
216 lines (153 loc) · 4.58 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
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
$( document ).ready(function() {
var score = 0;
$(".enemies").hide();
$("#gameover").hide();
$("#score").hide();
$("#crown").hide();
//What happens when you click "Play" button
$( "#playbutton" ).click(function() {
$('#playbutton').hide();
$("#boatpic").hide();
$('#alienpic').hide();
$("#paragraph").hide();
$("#header").hide();
$("#james").hide();
$(".enemies").show();
$("#score").show();
$("#crown").show();
setTimeout(function(){
$('.enemies').hide();
$('#crown').hide();
$('#gameover').show();
}, 10000);
});
//What happens when you click Alien1
$("#alien1").click(function() {
$(this).toggle('explode');
score = score + 5;
document.getElementById("points").innerHTML = score;
});
$("#alien2").click(function() {
$(this).toggle('explode');
score = score + 5;
document.getElementById("points").innerHTML = score;
});
$("#alien3").click(function() {
$(this).toggle('explode');
score = score + 5;
document.getElementById("points").innerHTML = score;
});
$("#alien4").click(function() {
$(this).toggle('explode');
score = score + 5;
document.getElementById("points").innerHTML = score;
});
$("#alien5").click(function() {
$(this).toggle('explode');
score = score + 5;
document.getElementById("points").innerHTML = score;
});
$("#alien6").click(function() {
$(this).toggle('explode');
score = score + 5;
document.getElementById("points").innerHTML = score;
});
$("#alien7").click(function() {
$(this).toggle('explode');
score = score + 5;
document.getElementById("points").innerHTML = score;
});
$("#alien8").click(function() {
$(this).toggle('explode');
score = score + 5;
document.getElementById("points").innerHTML = score;
});
$("#alien9").click(function() {
$(this).toggle('explode');
$("#crown").toggle('explode');
score = score + 10;
document.getElementById("points").innerHTML = score;
});
//move alien1
$( "#playbutton" ).click(function() {
function movealien1Right() {
$("#alien1").animate({left: "+=400"}, 2100, movealien1Left);
}
function movealien1Left() {
$("#alien1").animate({left: "-=360"}, 2000, movealien1Right);
}
movealien1Right();
//move alien2
function movealien2Right() {
$("#alien2").animate({left: "+=220"}, 2300, movealien2Left);
}
function movealien2Left() {
$("#alien2").animate({left: "-=200"}, 1900, movealien2Right);
}
movealien2Right();
//move alien3
function movealien3Right() {
$("#alien3").animate({left: "+=400"}, 2130, movealien3Left);
}
function movealien3Left() {
$("#alien3").animate({left: "-=430"}, 2000, movealien3Right);
}
movealien3Right();
//move alien4
function movealien4Right() {
$("#alien4").animate({left: "+=300"}, 1990, movealien4Left);
}
function movealien4Left() {
$("#alien4").animate({left: "-=340"}, 2120, movealien4Right);
}
movealien4Right();
//move alien5
function movealien5Right() {
$("#alien5").animate({left: "+=390"}, 2170, movealien5Left);
}
function movealien5Left() {
$("#alien5").animate({left: "-=410"}, 2470, movealien5Right);
}
movealien5Right();
//move alien6
function movealien6Right() {
$("#alien6").animate({left: "+=400"}, 2200, movealien6Left);
}
function movealien6Left() {
$("#alien6").animate({left: "-=380"}, 2400, movealien6Right);
}
movealien6Right();
//move alien7
function movealien7Right() {
$("#alien7").animate({left: "+=380"}, 1990, movealien7Left);
}
function movealien7Left() {
$("#alien7").animate({left: "-=409"}, 2400, movealien7Right);
}
movealien7Right();
//move alien8
function movealien8Right() {
$("#alien8").animate({left: "+=640"}, 2000, movealien8Left);
}
function movealien8Left() {
$("#alien8").animate({left: "-=600"}, 2300, movealien8Right);
}
movealien8Right();
//move alien9
function movealien9Right(){
$("#alien9").animate({left: "+=500"}, 750, movealien9Left);
}
function movealien9Left() {
$("#alien9").animate({left: "-=530"}, 750, movealien9Right);
}
movealien9Right();
//crown
function movecrownRight(){
$("#crown").animate({left: "+=500"}, 750, movecrownLeft);
}
function movecrownLeft() {
$("#crown").animate({left: "-=530"}, 750, movecrownRight);
}
movecrownRight();
});
});