Referencing 2 simultaneous touch coordinates

Get help using Construct 2

Post » Wed Jan 30, 2013 9:14 pm

Hi all,

I'm toying with the idea of making a 2 player game, where both players can control their player objects simultaneously. To do this I'd need to be able to reference each ones touch coordinates separately

e.g. on Plyr1 object touched -> set Plyr1 object to Touch.X

     on Plyr2 object touched -> set Plyr2 object to Touch.X

Because both players can touch their objects at the same time, I need a way to differentiate between the coordinates of Plyr1 Touch.X & Plyr2 Touch.X (so that they are not both moving to the same Touch.X).

I'm sure I've come across something like this on C2 before, but can't remember where I saw it. I've searched the forum, but I haven't found anything so far.

Could someone please put me out of my misery and tell me if there is a way to do this.

Thanks
B
18
S
4
G
2
Posts: 77
Reputation: 1,588

Post » Thu Jan 31, 2013 11:24 am

Okay, So I've started to answer my own question and thought it might be useful to others if I post what I've learned so far (don't get too excited, it's really not that much!).

After looking through and experimenting with some of the touch options, I've found that using "Touch.XAT(index)" will recognize two simultaneous touches, and allow players to move their objects separately/differently.

The problem I'm having now is recognizing which object is touched first. The "Touch.XAT(index)" requires a index/order number to be put into the "index" part. As I cannot be sure whether player 1 or player 2 will touch the screen first, how can I select the appropriate index number for the "Touch.XAT(index)" action.

Any help/examples would be greatly appreciated.

Thanks
B
18
S
4
G
2
Posts: 77
Reputation: 1,588

Post » Tue Feb 05, 2013 6:14 pm

I did something like this with another framework, but similar issue.

I was able to work around it by detecting which area of the screen the touch was registered and having designated control areas for each player.

Hope it helps!
B
4
S
1
Posts: 1
Reputation: 607

Post » Tue Feb 05, 2013 6:19 pm

Depending on your game you could change your control scheme so the player has to highlight what they are trying to move before they move it. You could then use to detect which player is which.
B
14
S
3
G
5
Posts: 41
Reputation: 3,490

Post » Tue Feb 05, 2013 7:03 pm

Thanks @astralvoid, @dsarchy, I'll take a look into those approaches to see if they can help me.
B
18
S
4
G
2
Posts: 77
Reputation: 1,588


Return to How do I....?

Who is online

Users browsing this forum: alextro, MarkStockley and 0 guests