2 player mode
alexxxhp
Member Posts: 161
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.
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
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
http://itunes.apple.com/it/app/touch-light/id349336187?mt=8
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.
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.
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.
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.
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.
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.
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.
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.