2 player mode

alexxxhpalexxxhp Member Posts: 161
edited November -1 in Tech Support
I am having a problem with 2 player mode
like both players touch a character and move them where ever they want at the same time without interfering with each other like a drag and drop but 2 different characters at the same time.

Comments

  • ktfrightktfright Member Posts: 964
    is it touch based or each person has a d-pad of some sort?
  • alexxxhpalexxxhp Member Posts: 161
    just touch no dpad both are touch at the same time and be able to move anyway they want by dragging your finger but at the same time.
  • alexxxhpalexxxhp Member Posts: 161
    any help regarding to players touching the screen at the same time and moving around by touch thanks
  • firemaplegamesfiremaplegames Member Posts: 3,211
    In your expression editor, you have access to devices. Under that is the touch attribute. you will need to act like it is one person using a two-finger multitouch.

    So for the first actor, youll need to use behaviors like constrain attribute: self.position.x to touch1.x and the second actor would get constrained to touch2.x

    i am in the car at the moment. I can answer better when i am back at my computer
  • alexxxhpalexxxhp Member Posts: 161
    cool thanks fire
  • venon_itvenon_it Member, PRO Posts: 594
  • alexxxhpalexxxhp Member Posts: 161
    I can play 2 player but my issue is the following when if the first player lift his finger off the screen the the second player becomes disabled how can I make the touch enable either one as 1st touch so even if the 1st player lifts his finger the second player continues as first and so on.
  • firemaplegamesfiremaplegames Member Posts: 3,211
    something like air hockey, right?

    ok, maybe when one player lifts their finger, the game no longer thinks there are two touches, so any rule that uses Touch2 will not work anymore?

    hmmm...

    that's tricky, I'll have to think about it... because if player 1 lifts his finger, player 2 now represents Touch 1 instead of Touch 2, right? And then if player 1 touches the screen again, THEY now become Touch 2...

    I'll have to do some tests to confirm.
  • alexxxhpalexxxhp Member Posts: 161
    exactly
  • PhoticsPhotics Member Posts: 4,172
    I hit this problem too. I was thinking of controlling character with the accelerometer, and using the touch screen to shoot. Unfortunately, the accelerometer gave a very unnatural feeling.

    I was thinking that I could do the dual touch screen controller thing, but that would mess up my interface layout. So, I thought about touch for shooting and a touch controller. Yet, I'm not sure that's a good idea, as wouldn't the player fire bullets whenever the controls are touched?

    I thought about Touch 1 / Touch 2... but which one would be which? I thought about separating the touches "inside" an area... but then how do I send the touch location to another character? I haven't been able to figure it out. I'm thinking it might be easier to figure out another control scheme than to try and juggle multiple touches.
  • ORBZORBZ Member Posts: 1,304
    divide the screen in half, test for what side of the screen the touch is on.
  • synthesissynthesis Member Posts: 1,693
    Orbz has it...if its head to head...just separate the screen.
  • PhoticsPhotics Member Posts: 4,172
    Is that still two touches or just one touch?

    Player one is touch one... player two is touch two... if Player two touches the screen first, how does the game know to assign it to player two?

    If it's just one touch... how do you grab location data without overriding?

    I thought about splitting the screen, but then when I went to grab touch data, I didn't know if I should select touch 1 or touch 2.
  • adadoadado Member Posts: 219
    Both players would still need to test for both touch 1 and touch 2. After sensing either, if the touch is on the side of the player, then respond to the touch. If not, ignore.

    Look at the dual joystick demo from CodeMonkey, each joystick responds to all touches but then senses which touch is its own based on the location of the touch.
  • synthesissynthesis Member Posts: 1,693
    set a rule that if a touch occurs on screen right...control player 1's stuff...and if a touch occurs on screen left...then that controls player 2 stuff.
    You may still need to have a touch 1 and touch 2...but it would be irrelevant whose touch it is because the screen is separated and all actors on the screen are tied to a touch's X coord. origin (if landscape orientation).

    I think that would work...haven't tested it.
  • firemaplegamesfiremaplegames Member Posts: 3,211
    you should account for all FIVE touches in BOTH Actors...

    If I touch the screen, NOT on an actor, that is touch 1, then I touch one of the actors, that is now Touch 2, then I touch the other actor, that is now touch 3.

    You never know which touch you will get on an actor.

    See CodeMonkey's joystick demo for a good solution of how to handle this.
  • PhoticsPhotics Member Posts: 4,172
    I created a touchy box, where the player could shoot. Below the box I put a control button. I made my gun turret react to touch 1.

    It worked great when the box was touched first. But if I pressed the button before shooting, The gun would not follow the second touch.

    I don't see how to make it if there's a touch on one part of the screen. A touch rule is assigned to an actor... and that touch is assigned to a number. I can send touch location to another actor, but I have to specify which touch number it is.

    I tried solving it mathematically, if touch1 X > touch2 X... then use touch 1... and that almost worked, but the gun turret would stop moving sometimes and all of these touch rules slowed down my game.
  • firemaplegamesfiremaplegames Member Posts: 3,211
    You need to duplicate your Rules 5 times, to account for each possible touch situation. see my above post...
  • firemaplegamesfiremaplegames Member Posts: 3,211
  • PhoticsPhotics Member Posts: 4,172
    I saw your post about five touches just after I made my post. I went back and I was able to get it to work.

    Heh, I didn't like it though. I don't like on-screen controls. My game was originally designed with a mouse and keyboard in mind. It plays great on my computer. But on my iPod, it's not a fun experience. I'm still fighting with it.
Sign In or Register to comment.