xronn Posted March 3, 2014 Share Posted March 3, 2014 Whats the correct name for the keys on keyboard input keys such as "a", "q" and "spacebar". This is what I wrote but it doesn't work: if (this.input.keyboard.isDown(Phaser.keyboard.A)){} Link to comment Share on other sites More sharing options...
Magnifisite Posted March 3, 2014 Share Posted March 3, 2014 I use the following:key = game.input.keyboard.addKey(Phaser.Keyboard.SPACEBAR);if (key.isDown()) {} Link to comment Share on other sites More sharing options...
xronn Posted March 3, 2014 Author Share Posted March 3, 2014 Thanks, i'm trying to kill/remove a sprite when I hit space but the sprite isn't being removed it just stays drawn.shopClose = this.input.keyboard.addKey(Phaser.Keyboard.SPACEBAR);shopUI = this.add.sprite(0, 0, 'shopUI');if (shopClose.isDown){ shopUI.kill();} Link to comment Share on other sites More sharing options...
rich Posted March 4, 2014 Share Posted March 4, 2014 Probably easier in a callback?shopClose = this.input.keyboard.addKey(Phaser.Keyboard.SPACEBAR);shopClose.onDown.add(closeIt, this);function closeIt() { shopUI.kill(); // other stuff} Link to comment Share on other sites More sharing options...
Recommended Posts