algut20 Posted June 30, 2015 Share Posted June 30, 2015 Hello guys, I am new to Phaser and programming in general. I encountered a problem while setting up the cursor controls for my player. The idea is for the player to shoot a bullet in the direction the player is pointing or running to, even while jumping. If i press the right-key and up-key at the same time and fire a bullet, everything works just fine. However, if I press the left-key and up-key at the same time and fire a bullet, the bullet does not fire. What is interesting is that If I hold the left-key and up-key at the same time and fire the bullet, the bullet fires, working just fine using the Numpad on the very same keyboard. So I thought I had a faulty keyboard and tried a different one, but I came up with the same results. Since I am new to Phaser, I am wondering If I am not doing something correctly? It would be nice to be able to use the specified key arrows instead of the numpad. For those interested, this is the part of the code that deals with the cursor mechanics (again, this code works just fine on the numpad): if (this.cursors.left.isDown) { if(this.fireButton.isDown){ this.fireBulletLeft();} this.player.body.velocity.x = - 150; this.player.animations.play('left'); } if (this.cursors.right.isDown) { if(this.fireButton.isDown ){ this.fireBulletRight();} this.player.body.velocity.x = 150;this.player.animations.play('right'); } if (this.cursors.up.isDown && this.player.body.touching.down) { this.player.body.velocity.y = -350; } Link to comment Share on other sites More sharing options...
rich Posted June 30, 2015 Share Posted June 30, 2015 Sounds like a typical keyboard ghosting issue to me: http://www.html5gamedevs.com/topic/4876-impossible-to-use-more-than-2-keyboard-input-buttons-at-the-same-time/ Link to comment Share on other sites More sharing options...
algut20 Posted June 30, 2015 Author Share Posted June 30, 2015 Hey thanks Rich. Ill check that out! Link to comment Share on other sites More sharing options...
Recommended Posts