FlopshotQQ Posted December 17, 2017 Share Posted December 17, 2017 Somewhat new to Phaser, the game is similar to pong and there's a two player mode. The problem I'm encountering is that when both directional keys for one paddle are being held down (A&D or LEFT&RIGHT) no more input is being accepted. Leaving the other player unable to move their paddle. Below is a simplified version of the code. Any help or information is appreciated //something to the effect of var paddle1Speed = 900; var paddle1Acceleration = 0; var paddle1Pressure = 10; var paddle2Speed = 900; var paddle2Acceleration = 0; var paddle2Pressure = 10; var maxPaddleAcceleration = 300; function update () { player2ControlListen (); player2ControlListen (); } function player1ControlListen () { if (game.input.keyboard.isDown(Phaser.Keyboard.LEFT)) { if (paddle1.body.velocity.x > -paddle1Speed) { if (paddle1Acceleration > -maxPaddleAcceleration) { paddle1Acceleration -= paddle1Pressure; } paddle1.body.velocity.x += paddle1Acceleration; } } if (game.input.keyboard.isDown(Phaser.Keyboard.RIGHT)) { if (paddle1.body.velocity.x < paddle1Speed) { if (paddle1Acceleration < maxPaddleAcceleration) { paddle1Acceleration += paddle1Pressure; } paddle1.body.velocity.x += paddle1Acceleration; } } } function player2ControlListen () { if (game.input.keyboard.isDown(Phaser.Keyboard.A)) { if (paddle2.body.velocity.x > -paddle2Speed) { if (paddle2Acceleration > -maxPaddleAcceleration) { paddle2Acceleration -= paddle2Pressure; } paddle2.body.velocity.x += paddle2Acceleration; } } if (game.input.keyboard.isDown(Phaser.Keyboard.D)) { if (paddle2.body.velocity.x < paddle2Speed) { if (paddle2Acceleration < maxPaddleAcceleration) { paddle2Acceleration += paddle2Pressure; } paddle2.body.velocity.x += paddle2Acceleration; } } } Link to comment Share on other sites More sharing options...
FlopshotQQ Posted December 17, 2017 Author Share Posted December 17, 2017 Turns out this was hardware related. Link to comment Share on other sites More sharing options...
Recommended Posts