-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy path6.js
55 lines (50 loc) · 1.12 KB
/
6.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
/*
* The round switches won't stay on unless something is placed on top of them.
*/
this.thrusters.bottom(true);
var thrusters = this.thrusters;
var instructions = [
{step: function (contact) {
thrusters.bottom(false);
thrusters.left(true);
}},
{step: function (contact) {
thrusters.left(false);
thrusters.top(true);
}},
{step: function (contact) {
}},
{step: function (contact) {
thrusters.top(false);
thrusters.left(true);
}},
{step: function (contact) {
thrusters.left(false);
thrusters.top(true);
}},
{step: function (contact) {
thrusters.top(false);
thrusters.left(true);
}},
{step: function (contact) {
thrusters.left(false);
thrusters.bottom(true);
}},
{step: function (contact) {
}},
{step: function (contact) {
thrusters.bottom(false);
thrusters.left(true);
}}
];
var next = function(contact) {
if (contact){
instructions[current_action].step(contact);
current_action++;
}
};
var current_action = 0;
this.on('sensor:top', next);
this.on('sensor:right', next);
this.on('sensor:left', next);
this.on('sensor:bottom', next);