Referencing 2 simultaneous touch coordinates

0 favourites
  • 5 posts
From the Asset Store
All popular touch mechanics - scrolling, zooming, swiping
  • 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.


  • 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.


  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • 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!

  • 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.

  • Thanks astralvoid, dsarchy, I'll take a look into those approaches to see if they can help me.

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)