Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*
- * The round switches won't stay on unless something is placed on top of them.
- */
- r = this;
- all_off = function() {
- r.thrusters.top(false);
- r.thrusters.bottom(false);
- r.thrusters.left(false);
- r.thrusters.right(false);
- }
- var step = 0, call = 0;
- sw = function(sensor, on, check, cb) {
- var this_step = call;
- call = call + 1;
- r.on("sensor:" + sensor, function(c) {
- if (c == check && step == this_step) {
- step = step + 1;
- all_off()
- r.thrusters[on](true);
- if (cb) cb();
- }
- });
- }
- r.on("start", function() {r.thrusters.bottom(true); });
- sw("top", "left", true);
- sw("right", "top", true);
- sw("left", "left", true);
- sw("right", "top", true);
- sw("bottom", "left", true);
- sw("right", "bottom", true);
- sw("left", "left", true);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement