playMaker

Author Topic: Cant use more than 1 touch input at a time :([SOLVED]  (Read 2373 times)

jasperPT

  • Full Member
  • ***
  • Posts: 115
  • I am a VFX Animator teaching myself to make games
Cant use more than 1 touch input at a time :([SOLVED]
« on: July 11, 2013, 06:27:32 PM »
Hi,

I am struggling to get playmaker to recognize two separate touch inputs at the same time in one scene.
After trying a few different approaches I have decided that I must be doing it in a far more round about or difficult way than was intended, but cant quite figure out what is the norm.

I have attached two images for reference of my scene and fsms.

The first image has a tile selected. This tile knows if it belongs to player 1 or player 2.

There will be an instance of this tile as player 1 and player 2 in the scene at the same time, when you click on the tile it shoots an object. If you hold it, it shoots a bigger object.

Currently If i hold down on my screen, the other player is unable to hold down at the same time.

How my FSM works.

I have an Input manager, that handles all the information from inputs.
These Tiles, recognise when they have been touched, and send information to an FSM inside the input manager.

If it is a player 1 tile, it sends the information to a player 1 FSM (inside the input manager, shown in image 2)

If it is a player 2 tile, it does the same thing to a player 2 FSM

So in theory these two should function independently and be able to track two separate inputs, but the dont seem to be able to do so.

Can anyone tell me what it is I am doing wrong? Or of there is a simpler way to go about this?
« Last Edit: July 12, 2013, 03:03:22 PM by jeanfabre »

escpodgames

  • Hero Member
  • *****
  • Posts: 687
    • Assets
Re: Cant use more than 1 touch input at a time :(
« Reply #1 on: July 11, 2013, 09:23:21 PM »
Use a separate FSM for each player, just in case there is an edge case of both players performing an input at the same time.
« Last Edit: July 11, 2013, 09:25:13 PM by LampRabbit »

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
Re: Cant use more than 1 touch input at a time :(
« Reply #2 on: July 12, 2013, 03:25:15 AM »
Hi,

It's very important to store the "finger id" to track that finger. else you will get mixed up.

as LampRabbit said, you may need to use prefabs here. And by recording the finger id, each prefab instance will be able to catch it's own touch, and keep track of it.

If that doesn't help let me know, I can digg an example where I had multi touch management.

Bye,

 Jean

jasperPT

  • Full Member
  • ***
  • Posts: 115
  • I am a VFX Animator teaching myself to make games
Re: Cant use more than 1 touch input at a time :(
« Reply #3 on: July 12, 2013, 07:12:54 AM »
I seperated out the tile onto two seperate fsms, one for each player.
Seems like a strange thing to happen, but now it works perfectly!
Thanks so much for your help, would never have thought of that.