2 Player touch

Get help using Construct 2

Post » Tue Feb 05, 2013 5:18 pm

Hi All,

I'm trying to create a two player game, and I want both players to be able to control their player objects separately and at the same time. But I'm having trouble coming up with a way to do this.

At first I though that using Touch.XAT(index) might be the solution. But I don't know how I should reference the index part for each object.

From what I understand the Touch.XAT(index) command requires an index number, which relates to the order of each touch e.g. 0, 1, 2, 3.... etc. How can I find out the order each object was touched, so that I can use that information to select the correct index value for Touch.XAT().

I've attached a capx of what I have so far. I currently have both set to index 0, which is okay if you touch the objects 1 at a time, but if you try to touch both together, they both go to the same .X position. I've tried to set the index property on plyr2 to (1), but this only works if plyr2 touches the screen after plyr1, and as I can't tell which player will touch the screen first this won't work.

https://dl.dropbox.com/u/78057629/TouchProject.capx

Can someone let me know if I'm on the right lines, or have I completely misunderstood what Touch.XAT(), is for?

Thanks for your help.
B
18
S
4
G
2
Posts: 77
Reputation: 1,588

Post » Tue Feb 05, 2013 7:32 pm

Touch ForId is what your looking for. Anything is impossible to product capable multi touch in a long term control manner.

the problem with index is that index is 0 based. meaning that the touches that go down and released in order stay in order. However long term forms of touching similar to 2 analogs or 2 players don't produce good results.

finger 1 goes down index 0
finger 2 goes down, index 1
finger 1 goes up no index as it's released
finger 2 becomes index 0

totally does not work

ForID however gives each touch it's own id that stays persistent. Good luck.
B
87
S
18
G
9
Posts: 2,455
Reputation: 14,834

Post » Tue Feb 05, 2013 8:08 pm

Thanks @jayderyu, I'll try the Touch ForID approach.
B
18
S
4
G
2
Posts: 77
Reputation: 1,588


Return to How do I....?

Who is online

Users browsing this forum: imnotspecial, tomi71, totoe, Yahoo [Bot] and 15 guests