Multitouch - fast swipe

I think I have read every article on multitouch, but I am still having a problem under 1 circumstance…  can someone help or give me ideas on how to solve?

I am working on a retro space shooter, and I have several buttons… rotate left, rotate right, thrust, and fire.  It is possible that you can press rotate and thrust at the same time, so I enabled multitouch.  Seems that while playing the game on devices, users tend to slide their fingers off of the buttons, so I added an invisible image on top of the buttons, and when the image has moved a certain distance away from the button, I stop the action (read that in a forum thread somewhere).  

This seems to work well… if the movement isn’t very fast.

If the player moves his finger/thumb off of the rotate button (as an example) very fast while lifting off of the device, the rotation just continues… no “ended” or “cancelled” event is fired.  This seems to happen more and more as the intensity of the game picks up.

I am a bit stumped at this point… how do I make sure that rotation and/or thrust doesn’t just continue forever?

Thanks,

–john

Hi John,

When these “non events” occur, is the user’s touch actually over the button at that time, or off the button? Have you tried using focus methods instead of the outlying object?

Brent

Hi Brent,

They are generally off the button.  In the “moved” event I check to see if the circle image is certain distance from the button and if it is, then I reset.  This stops the rotation under normal circumstances.  In fast swipes, the circle image never gets the “ended” event so when the user lifts his/her finger, you can see the circle image (it’s not fully invisible, alpha = 0.1) where the user lifted, and the rotation continues.

I did try setFocus, but the issue still remains.  Also when using setFocus, it seems to limit the focus on the one button (as I believe it should).  Using setFocus, the user no longer can press the thrust button since the events are focused on the rotate button currently pressed and moving.

Thanks for your help!

Hi John,

Did you thoroughly explore using :setFocus along with multitouch? I think it varies a little according to the docs:

http://docs.coronalabs.com/daily/api/type/StageObject/setFocus.html

I personally haven’t done anything with both :setFocus and multitouch combined, but you should be able to have multi-object focus with IDs for each. It might just take some extra coding to get your game to react to this properly.

Brent

I will go back and give setFocus another try, but I can simulate this never-ending rotation in the simulator as well… When I do a fast click/move. Since the sim does not support multi-touch, i am under the impression that it is something unrelated to multitouch in general, but cannot completely rule that out. I appreciate your help Brent.

Hi John,

When these “non events” occur, is the user’s touch actually over the button at that time, or off the button? Have you tried using focus methods instead of the outlying object?

Brent

Hi Brent,

They are generally off the button.  In the “moved” event I check to see if the circle image is certain distance from the button and if it is, then I reset.  This stops the rotation under normal circumstances.  In fast swipes, the circle image never gets the “ended” event so when the user lifts his/her finger, you can see the circle image (it’s not fully invisible, alpha = 0.1) where the user lifted, and the rotation continues.

I did try setFocus, but the issue still remains.  Also when using setFocus, it seems to limit the focus on the one button (as I believe it should).  Using setFocus, the user no longer can press the thrust button since the events are focused on the rotate button currently pressed and moving.

Thanks for your help!

Hi John,

Did you thoroughly explore using :setFocus along with multitouch? I think it varies a little according to the docs:

http://docs.coronalabs.com/daily/api/type/StageObject/setFocus.html

I personally haven’t done anything with both :setFocus and multitouch combined, but you should be able to have multi-object focus with IDs for each. It might just take some extra coding to get your game to react to this properly.

Brent

I will go back and give setFocus another try, but I can simulate this never-ending rotation in the simulator as well… When I do a fast click/move. Since the sim does not support multi-touch, i am under the impression that it is something unrelated to multitouch in general, but cannot completely rule that out. I appreciate your help Brent.