Fairydhwen Posted May 7, 2016 Share Posted May 7, 2016 Hi, I'm reading this tutorial (2nd part) : http://www.gamefromscratch.com/post/2014/06/24/Adventures-in-Phaser-with-TypeScript-Handling-Keyboard-Input.aspx in the second exemple, we got something like : class SimpleGame { constructor() { this.game = new Phaser.Game(640, 480, Phaser.AUTO, 'content', { create: this.create});} moveUp(e: KeyboardEvent) { this.jetSprite.position.add(0, -1); } create() { this.W.onDown.add(SimpleGame.prototype.moveUp, this); } } can someone tell me why we need to use SimpleGame.prototype.moveUp to call this method? (and not just this.moveUP ?) is this because we are using this context ? regards, Link to comment Share on other sites More sharing options...
Recommended Posts