2 Player touch

0 favourites
  • 3 posts
From the Asset Store
Players follower. use it for anything which follows the player
  • 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.

    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.

  • Try Construct 3

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

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

  • Thanks jayderyu, I'll try the Touch ForID approach.

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