-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathresetSprites.js
104 lines (91 loc) · 1.68 KB
/
resetSprites.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
//reset sprite data
function shootFire(fx){
fireobj = document.getElementById('fireshot');
fireobj.style.left = fx + 'px';
fireobj.style.visibility = 'visible';
}
function resetFire(){
fireobj = document.getElementById('fireshot');
fireobj.style.visibility = 'hidden';
}
function canonMove(tocanx) {
var canon = document.getElementById("canon");
var canvelocity = 10;
var id = setInterval(frame, 2);
function frame() {
if (canx == tocanx) {
var sf = setTimeout(resetFire, 200);
shootFire(canx);
clearInterval(id);
} else {
if(canx<tocanx){canx+=canvelocity;}
else{canx-=canvelocity;}
canon.style.left = canx + 'px';
}
}
}
function resetSS1(){
if(ss1sum == canoncontent){
hits++;
canonMove(50);
ss1y = 0;
setss1content();
setcanoncontent();
ss1.style.top = ss1y + 'px';
}
else{
miss--;
}
}
function resetSS2(){
if(ss2sum == canoncontent){
hits++;
canonMove(250);
ss2y = 0;
setss2content();
setcanoncontent();
ss1.style.top = ss2y + 'px';
}
else{
miss--;
}
}
function resetSS3(){
if(ss3sum == canoncontent){
hits++;
canonMove(450);
ss3y = 0;
setss3content();
setcanoncontent();
ss1.style.top = ss3y + 'px';
}
else{
miss--;
}
}
function resetSS4(){
if(ss4sum == canoncontent){
hits++;
canonMove(650);
ss4y = 0;
setss4content();
setcanoncontent();
ss1.style.top = ss4y + 'px';
}
else {
miss--;
}
}
function resetSS5(){
if(ss5sum == canoncontent){
hits++;
canonMove(850);
ss5y = 0;
setss5content();
setcanoncontent();
ss1.style.top = ss5y + 'px';
}
else {
miss--
}
}