Skip to content

Instantly share code, notes, and snippets.

@joseph-montanez
Created May 27, 2011 19:39
Show Gist options
  • Save joseph-montanez/995987 to your computer and use it in GitHub Desktop.
Save joseph-montanez/995987 to your computer and use it in GitHub Desktop.
This makes me love Vala
this.player = new Darkcore.Sprite();
this.player.on_key_press = ((a) => {
// We are able to retain scope yay!
if (this.keys.up) {
this.player.y += 4;
}
if (this.keys.down) {
this.player.y -= 4;
}
if (this.keys.left) {
this.player.x -= 4;
}
if (this.keys.right) {
this.player.x += 4;
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment