-
Notifications
You must be signed in to change notification settings - Fork 0
/
script3.js
65 lines (57 loc) · 1.53 KB
/
script3.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
wrapPilot = function(thing) {
if (thing.x < 0) {
thing.x += thing.fw;
} else if (thing.x > thing.fw) {
thing.x -= thing.fw;
}
// if (thing.x < thing.wingSpan()) {
// thing.x = thing.fw - thing.wingSpan();
// } else if (thing.x > thing.fw - thing.wingSpan()) {
// thing.x = thing.wingSpan();
// }
var floor = thing.fh + thing.noseSpan() - thing.engineSpan() - 4;
if (thing.y < thing.topLimit()) {
thing.positionAtTop();
if (thing.game.quantumpilot) {
thing.game.advanceToQuantumPilot();
thing.positionAtBottom();
// thing.y = thing.fh - thing.engineSpan() - 4;
}
} else if (thing.bottomPoint() > thing.fh) {
thing.positionAtBottom();
// thing.y = floor;
}
}
wrapClone = function(thing) {
if (thing.x < 0) {
thing.x += thing.fw;
} else if (thing.x > thing.fw) {
thing.x -= thing.fw;
}
// if (thing.x < thing.wingSpan()) {
// thing.x = thing.fw - thing.wingSpan();
// } else if (thing.x > thing.fw - thing.wingSpan()) {
// thing.x -= (thing.fw);
// thing.x += thing.wingSpan();
// }
if (thing.y < thing.engineSpan()) {
thing.y = thing.engineSpan();
} else if (thing.y > thing.fh - thing.noseSpan()) {
thing.y = thing.fh - thing.noseSpan();
}
}
wrapBullet = function(thing) {
if (thing.x < 0) {
if (thing.ox) {
thing.mx = Math.abs(thing.mx);
} else {
thing.x = thing.fw;
}
} else if (thing.x > thing.fw) {
if (thing.ox) {
thing.mx = -Math.abs(thing.mx);
} else {
thing.x = 0;
}
}
}