MarkAndrade

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

Recommended Posts

Hi,

 

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. 
 
--
Mark

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...

  • Recently Browsing   0 members

    No registered users viewing this page.