Jump to content

update() called twice when mouse is down and moving?


Recommended Posts



I'm porting some cocoa code over to TypeScript and I'm currently working on the virtual joystick code.  I noticed that if a mouse/touch is down and moving, update() will be sent twice.  At least it appears that way.


You can see an example of the anomaly here:  http://www.sputnikgames.com/test/  If you constantly move your finger while holding the joystick thumb pad, the fish will move faster than if you hold your finger still on a direction with the thumb pad.


The virtual joystick class has an update() method that's called by Phaser.  If I remove it's update method and simply call a private method from the main update(), it will still show the same behavior.  So this means to me that update() is getting fired off multiple times, or the pollRate changes or something.  I just don't know.


Thinking it was a hardware issue, I've tested this out on every system I have from Windows Phone, Android phones and tablets, iOS 6-7, iPad iPhone, desktops, etc and they all show the same behavior.  I looked through all the docs and tried many different things but nothing seems to stop update() from acting strange when the mouse is down and dragging.

I did find a work around by using setMoveCallback() in my class and then calling my own update method on each joystick class. Before I settle on using setMoveCallback() I just wanted to be sure I wasn't stumbling on a bug or something simple I'm missing from my code.
If anyone can go to the URL above to see if they see the same thing and post what they find here I'd appreciate it.  Maybe this is the correct behavior?
Thanks everyone. 
Link to comment
Share on other sites


  • Recently Browsing   0 members

    • No registered users viewing this page.
  • Create New...