Counting touches for multi-touch
iPhoneDevForMe
Member Posts: 362
I am having an issue with multi-touch! I have yet to find any guides or forum posts explaining it. I have multiple actors that you drag accross the screen using constrain behaviors. When I touch a another actor (while still touching the first) the second one moves to the location of the first.
Ive been playing with it for awhile and here is the logic ive been trying to get work (it does not!)
Rule- When actor receives touch pressed
change attribute game.touches.count to game.touches.count+1
Rule- When game.touches.count = 1
constrain self.x/y to touch1.x/y
Rule- When game.touches.count = 2
constrain self.x/y to touch2.x/y
And so on...
Rule- When actor receives touch released
change attribute game.touches.count to game.touches.count-1
How far off am I from even coming close? I just want to be able to touch 4 different actors on the screen at once and move them all at the same time in any direction.
Can anyone provide any insight? Thanks in advance!
Ive been playing with it for awhile and here is the logic ive been trying to get work (it does not!)
Rule- When actor receives touch pressed
change attribute game.touches.count to game.touches.count+1
Rule- When game.touches.count = 1
constrain self.x/y to touch1.x/y
Rule- When game.touches.count = 2
constrain self.x/y to touch2.x/y
And so on...
Rule- When actor receives touch released
change attribute game.touches.count to game.touches.count-1
How far off am I from even coming close? I just want to be able to touch 4 different actors on the screen at once and move them all at the same time in any direction.
Can anyone provide any insight? Thanks in advance!
Comments
I only saw the joystick control demo on there. The demo has multitouch but it's used in a diff way and so far I havnt figured out a way to make it function the way I need it to.
Were there any other demos I might have missed? Thanks!!
Counting touches can be used for something like this. I used touches.count=2 for zooming out of a scene when it is zoomed in. So when touches.count=2 it moved the camera out. The user would then be dragging the camera around with one finger and by tapping the second finger down it zoomed out.
From what I understand touch count just does this, tells the system how many fingers are down, not telling it which finger is doing which touch.