Help with multi-touch

Hello.
I need to use the multi-touch feature on a game, I want to learn how to use it.
So here what I’ve been trying to do:
The game has two rectangles(one red and one green). I want that the green one moves and follow the touch when the lower side of the screen is touched, it can only move horizontaly. I want the same with the red one, but it will only move when the upper side of the screen is touched.

As you have guessed, the two rectangles can move simultaneously when two players touches both sides of the screen, thats why I am using the multi-touch feature. I’m having trouble dealing with the touch id too.

Can someone help me?

Check out the multitouch example :slight_smile:

1 Like

I already looked.
I just want to understand how the multitouch feature really works. It didn’t help much when I saw the example, manly because it doesn’t exactly match what I’m looking for.
Is there a tutorial (except the one that the Gdevelop site already offers) or youtube video? this would help!

What have you done so far?

The two rectangles moves when the screen is touched, but I can’t make them move simultaniosily. When the second touch is made, the previous rectangle stops moving.

The touch example @Gruk mentioned is exactly what you’re after. It may not do what you want perfectly, and you cannot expect that. It shows you how to get the touch id, and use it to move the object under the touch. This is what you are after.

With a little bit of thought you can use those concepts for your game. For one, instead of creating the marker, determine which rectangle the touch belongs to.

1 Like

@MrMen thanks! I guess it will come in handy!