Multi-touch in onTouchStart

Hi. Sorry to bother. I have a question with cocos creator.
Can we get multitouch in ontouchstart event?
I have some problem with multitouch.
Please help me if you can.

Please explain your issue more and we can ask @jare to read what you write.

Thank you. I want to get a multitouch event when a player is moving.
So when a player is moving and if you touch with second finger, player should stop and punch.
But when player is moving(so it is touchmove), even if I touch the screen, touch start report only one touch with “event.getTouches” method. So I can’t get when to stop player and run punch action.
“event.getTouches” recognizes multitouch on touchmove event, but doesn’t on touchstart from what I think.
Please guide me with this.

From what I understand, the event.getTouches on the second event only has 1 finger starting a touch, so you will need to handle some touch logic outside of the event listener if you want to know how many fingers are on screen.

For example, user touches the first finger, the event triggers with 1 touch in the event, you can start a counter variable (ex: int touches = 0) … then touches++, then when you touch again, now (touches++) = 2.
Just make sure to remove them on touch ended AND touch canceled.

For better information, you can store the actual cc.Touch inside an array and sort them by occurrence, then pop them off the array as they are complete.

3 Likes

I’m a fan of storing touches too. I’ve been able to create some cool effects over the years because I had this handy. I can also show the player things about their habits.

2 Likes

Thank you. I’ll handle this as you say.

Thank you too. You’ve always been a great help. I’m so grateful.

1 Like

This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.