Created
July 9, 2013 06:26
-
-
Save ahpook/5955122 to your computer and use it in GitHub Desktop.
Solution to http://bitsquest.bitbucket.org/index.html#4 , even though it's not necessary to use the variable (you can just go up and right till you hit the right wall, then down)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var beenTop = false; | |
this.on("start", function() { | |
this.thrusters.left(true); | |
}); | |
this.on('sensor:top', function(contact) { | |
this.thrusters.bottom(false); | |
beenTop = true; | |
}); | |
this.on('sensor:right', function(contact) { | |
if (beenTop) { | |
this.thrusters.top(true); | |
} | |
else { | |
this.thrusters.bottom(true); | |
} | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment