How do I detect multi touch simultaneously?

Get help using Construct 2

Post » Mon Dec 14, 2015 12:38 pm

I want to detect the location of touch on different side of the screen.

The basic idea is that:

Touch: Is in touch:
Touch.X<(LayoutWidth/2) : Set var1 to Touch.X
Touch.X>(LayoutWidth/2) : Set var2 to Touch.X

How do I get the system to recognize different Touch.X?

Currently when I touch one side of the screen the other side wouldn't register.
B
23
S
10
G
2
Posts: 104
Reputation: 3,071

Post » Mon Dec 14, 2015 12:41 pm

From the manual:

Multi-touch
The Touch object supports multi-touch. This is most useful with the On touched object and Is touching object conditions, which can for example detect if multiple on-screen touch controls are being used. This is sufficient for many games.

For more advanced uses, the TouchID, XForID and YForID expressions can be used to track individual touches for different purposes. Each touch has a unique ID (which is an arbitrary number), and can be accessed using the TouchID expression in an event like On any touch start. The touch ID can then be stored in a variable and tracked using the XForID and YForID expressions. Finally comparing the TouchID in On any touch end indicates when that touch has been released.
I told my dentist I had trouble with my teeth and asked her to fix it without looking in my mouth..
B
54
S
16
G
8
Posts: 6,160
Reputation: 19,775

Post » Mon Dec 14, 2015 9:24 pm

I read about that part. How do I find TouchID? Do I define it myself?
B
23
S
10
G
2
Posts: 104
Reputation: 3,071

Post » Mon Dec 14, 2015 9:45 pm

Each touch has a unique ID (which is an arbitrary number), and can be accessed using the TouchID expression in an event like On any touch start. The touch ID can then be stored in a variable and tracked using the XForID and YForID expressions. Finally comparing the TouchID in On any touch end indicates when that touch has been released.

So on touch start you can get the id for that touch..
Touch.TouchID is this id..

The touch zooming example and the touch rotating example shipped with Construct2 show examples of multitouch..
I told my dentist I had trouble with my teeth and asked her to fix it without looking in my mouth..
B
54
S
16
G
8
Posts: 6,160
Reputation: 19,775


Return to How do I....?

Who is online

Users browsing this forum: istero and 7 guests