This repository has been archived by the owner on Jan 4, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 3
/
Blockly Games - Pond(2).js
80 lines (80 loc) · 1.73 KB
/
Blockly Games - Pond(2).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
while (true) {
while (loc_x() < 50 && loc_y() > 50) {
swim(315, 100);
quickscan();
}
stop();
detect();
while (loc_x() < 90 && loc_y() < 90) {
swim(45, 100);
quickscan();
}
stop();
detect();
while (loc_x() > 50 && loc_y() > 50) {
swim(225, 100);
quickscan();
}
stop();
detect();
while (loc_x() < 90 && loc_y() > 10) {
swim(315, 100);
quickscan();
}
stop();
detect();
while (loc_x() > 50 && loc_y() < 50) {
swim(135, 100);
quickscan();
}
stop();
detect();
while (loc_x() > 10 && loc_y() > 10) {
swim(225, 100);
quickscan();
}
stop();
detect();
while (loc_x() < 50 && loc_y() < 50) {
swim(45, 100);
quickscan();
}
stop();
detect();
while (loc_x() > 10 && loc_y() < 90) {
swim(135, 100);
quickscan();
}
stop();
detect();
}
function quickscan() {
for (var i = 0; i < 16; i++) {
if (scan(i * 20, 20) <= 70) cannon(i * 20, scan(i * 20, 20));
}
}
function sweep() {
for (var i = 0; i < 72; i++) {
if (scan(i * 5) <= 70) cannon(i * 5, scan(i * 5));
}
}
function dualSweep() {
for (var i = 0; i < 72; i++) {
if (scan(i * 5) <= 70) cannon(i * 5, scan(i * 5));
if (scan(i * 5 + 180) <= 70) cannon(i * 5 + 180, scan(i * 5 + 180));
}
}
function fullOnAttack() {
for (var i = 0; i < 72; i++) {
if (scan(i * 5) <= 70) cannon(i * 5, scan(i * 5));
if (scan(i * 5 + 90) <= 70) cannon(i * 5 + 90, scan(i * 5 + 90));
if (scan(i * 5 + 180) <= 70) cannon(i * 5 + 180, scan(i * 5 + 180));
if (scan(i * 5 + 270) <= 70) cannon(i * 5 + 270, scan(i * 5 + 270));
}
}
function detect() {
if (health() >= 75) quickscan();
else if (health() >= 50) sweep();
else if (health() >= 25) dualSweep();
else fullOnAttack();
}