AlexArroyoDuque Posted July 18, 2014 Share Posted July 18, 2014 Hi!I upgraded from version 2.0.5 phaser to 2.0.7.I have created some controls that do something when they are pressed. In version 2.0.5 I used IsDown but now I have an error that is undefined ... Has been removed IsDown? This is some of my code: theGame.cursors = { 'left': theGame.game.input.keyboard.addKey(65), //a 'right': theGame.game.input.keyboard.addKey(68), //d 'down': theGame.game.input.keyboard.addKey(83), //s 'up': theGame.game.input.keyboard.addKey(87), //w }; if (theGame.cursors.left.isDown) { ... } A greeting. Link to comment Share on other sites More sharing options...
Dumtard Posted July 18, 2014 Share Posted July 18, 2014 As far as I can tell it works fine, we could help you more if you show us the actual error and more code.I tested with this code and it all worked fine: create: function() { this.keyboard['ONE'] = this.game.input.keyboard.addKey(Phaser.Keyboard.ONE);}update: function() { if (this.keyboard.ONE.isDown) { console.log('ONE has been pressed'); }} Link to comment Share on other sites More sharing options...
AlexArroyoDuque Posted August 6, 2014 Author Share Posted August 6, 2014 I believed that problem was 'isDown' but the keyboard works fine. However with the pad controller I have problems. Some of my code: this.pad1 = this.game.input.gamepad.pad1; this.game.input.gamepad.start(); this.cursors = { 'left': this.game.input.keyboard.addKey(65), //a 'leftPad': this.input.gamepad.pad1.addButton(Phaser.Gamepad.BUTTON_2) }; // this.cursors.leftPad is null if (this.cursors.left.isDown || this.cursors.leftPad.isDown) {...} // Error because this.cursors.leftPad.isDown is undefined Link to comment Share on other sites More sharing options...
Recommended Posts