Month: March 2017

Phaser game.input.onUp event firing twice!

Phaser game.input.onUp event firing twice!

Game Development, Phaser, Tips & Tricks
Yesterday I was making a game for an online course I'm writing. The game has a flying cat and when you click anywhere on the canvas the cat will change position. This is the line of code I was using: game.input.onUp.add(this.changePos, this); The game was working fine on desktop mode, but when I changed to the mobile simulator on Google chrome it looked like the event did not fire at all because the cat didn't move. After about 15 minutes of trying to debug, I found that instead of not firing the event was actually firing twice. What was happening was that the browser was detecting two different events. A touch event for the device A mouse event from the browser If I had simply tested the game on mobile, it would have worked fine, because the mobile device would not have ...