problems with multitouch implementation. please help.

chandan1014chandan1014 Member Posts: 14
edited November -1 in Working with GS (Mac)
Alright, so while making an ipad game which basically involves two users to input at the same time, i ran into a problem. My gameplay screen is divided into two equal halves and each user touches a point where his actor follows. So i created two large invisible actors which define the equal halves of the gameplay and are supposed to store the co-ordinates of the point of touch for each player. Now suppose player1 (and only player1) touches his part of the device, and the touch gets registered as touch1, and i get to know the co-ordinates of the touch point. The problem is, in a situation when both the players touch the device at the same time, i don't know if touch2 was done by player1 or player2, since i don't know if player1 touched the device first or player2. I have trouble deciding where to get the position values from, i.e. from touch1 or touch2.
So what i need to know is the number of the touch (touch1 or touch2) that is touching my actor so that i can set it to get position co-ordinates form that touch. Is there any way that i can get the touchX (where X is the no. of touch which touches the actor) value?

Any help would be deeply appreciated. Waiting for an answer. Fingers crossed!

Comments

  • jonmulcahyjonmulcahy Member, Sous Chef Posts: 10,408
    Could you just create two actors as hotzones and use those to detect touches for each player? Like split the screen in half, create two actors player1zone and player2zone.
  • chandan1014chandan1014 Member Posts: 14
    @mulcahy: that's exactly what i did, created two actors which can detect if they are touched. but the problem is, the actors don't know who they were touched by (touch1, touch2, touch3....). they just know they were touched.
    i have written my rule like this, in case the actor is touched, it will store the value of touch1 or touchX. i need to know if the touch that touched the actor was touch1 or touch2 so that i can store the value of that specific touch.
  • chandan1014chandan1014 Member Posts: 14
    or is there any other way to get my concept to work? i basically need to be able to let two users control their actor movements at the same time?
    waiting for reply...
  • firemaplegamesfiremaplegames Member Posts: 3,211
    For the iPhone/iPod, all of your actors need to account for all 5 Touches, since you don't know in what order they will be touched. Check out CodeMonkey's joystick demo for a good way to handle this.

    The iPad can handle 11 Touches, so I'm not sure if every actor needs to account for all 11? I haven't played with it yet.
  • chandan1014chandan1014 Member Posts: 14
    checked codemonkey's joystick demo. it sounds silly, but i couldn't find a way to download that demo, i was just able to play it in safari. can anybody please guide me how to download that as a gamesalad project?

    edit: i figured it out. please pardon me for the silly question

    edit #2: the downloaded file is a .game file which gamesalad seems incapable of opening. am i doing something wrong?

    edit #3: pardon my me being silly. figured it out :)

    edit #4: @firemaplegames: thanks for the help
  • firemaplegamesfiremaplegames Member Posts: 3,211
    From the website, you can right-click (control-click) on the blue Download Project button and select "Download Linked File"...

    HOWEVER, this will download a file ending with a .game extension. which is not openable by GameSalad.

    You need to rename the extension from .game to .zip

    Then, Double-click on the .zip file and you will get the appropriate .gameproj file.

    Alternatively, when you are browsing the demos and tutorial, you will notice that the file has a few tags associated with it. You can use these tags to search for the file in GameSalad Creator, under the Shared Projects tab. That way you don't even have to download the project, it will open up directly in GameSalad.
Sign In or Register to comment.