How to get the coordinates from the last touch?

scrapee_netscrapee_net Member Posts: 424
edited November -1 in Working with GS (Mac)
Its a few hard to explain, but I will...
In my game, the users can drag and drop the actors. But, for example, if there is more then one touch on the screen, it will take the coordinates of the first touch... So, when I touch first any area on the screen, and then put another finger on the actor, it moves to the position of the first touch, because its set to get the position of the Touch 1...

One bad solution that I found, is to check if is there more than one touch, and if so, do nothing when the user tries drag the actor...

My code to drag the actors is this one:

Constrain attribute self.Motion.Linear Velocity.Y to 10*( game.Touches.Touch 1.Y - self.Position.Y )
Constrain attribute self.Motion.Linear Velocity.X to 10*( game.Touches.Touch 1.X - self.Position.X)
Change Attribute self.Touch Y To self.Position.Y
Change Attribute self.Touch X To self.Position.X

I'd like a better option, if possible. I tough about getting the coordinates of the last touch, but I think in this case, I would need to create 12 rules, to check each one of them, because as I know, its not possible to do like this:

Constrain attribute self.Motion.Linear Velocity.Y to 10*( game.Touches.(game.Touchs.Count).Y - self.Position.Y )
---

Another possible solution that I can think, is to get the touch number that is over the actor, and then thru rules, check its postion. In this case I would need 12 rules at last again....

Is there any better solution?

Comments

Sign In or Register to comment.