Created
January 31, 2012 22:52
-
-
Save jamorton/1713593 to your computer and use it in GitHub Desktop.
This file contains 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
#-------------------------------- | |
# A simple language, one step above Scratch. | |
#-------------------------------- | |
tom = Sprite "cat.png" | |
when start | |
move tom 10 | |
end | |
when tom:x > 5 | |
if tom:x is 7 | |
output "it's 7!" | |
end | |
flip tom | |
end | |
loop i to 5 | |
output i | |
end | |
#--------------------------------- | |
# how this would be compiled to javascript | |
#--------------------------------- | |
var tom = new Sprite("Cat.png"); | |
Event.add( | |
new Event.start(), | |
function() { | |
Global.move(tom, 10); | |
} | |
); | |
Event.add( | |
new Event.expr(function() { | |
return tom.x > 5; | |
}), | |
function() { | |
Global.output(tom.x); | |
} | |
); | |
for (var i = 0; i < 5; i++) | |
Global.output(i); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment