How to easily despawn an actor constrained to your touch position when you lift that touch

Okay, so I want to track multi-touches on the screen as separate entities. My plan is to do this by constraining specific actors to each Touch input whenever a new Touch input is registered on the screen.
If you touch the screen with one finger, I want that to be "Touch 1". TouchTracker1 will spawn and constrain itself to that first touch.
If you place a second finger down on the screen, I want that to be "Touch 2." TouchTracker2 will spawn and constrain its coordinates to that second touch location.
If you remove your first finger from the screen, I want TouchTracker1 to destroy, but TouchTracker2 to still be alive and active.
I made some actors that I figured I'd just constrain the coordinates of:
Actor1 X,Y to Touch 1 -> X & Y
Actor2 X,Y to Touch 2 -> X & Y
etc etc.
However I'm running into some trouble.
I have an Actor that spawns these TouchTrackers using Devices>Touch>Count.
Rule:
When Attribute>Devices>Touch>Count = 1
Spawn: TouchTracker1 at the coordinates of Touch1 X/Y
And in TouchTracker1:
Rule:
Actor Receives event Touch released >Destroy Actor
Otherwise:
Constrain coordinates to Touch 1 X, Y.
However, this doesn't even work with the singular case. Pressing a single finger down spawns the actor and constrains it to your moving touch correctly... but lifting your finger doesn't destroy the actor.
This doesn't even account for the case of having TWO TouchTrackers. It'd work until you lifted Touch 1. Then because Devices>Touch>Count went from being 2 to 1, it'd respawn TouchTracker1. BLARGH.
!) Anyone have any suggestions for getting TouchTracker to properly destroy upon touch release? Why is that not triggering?
2) Is there a way to create a rule that tracks an Attribute TRANSITIONING from one value to another? Seems like a pretty basic game engine thing -> Rule: Trigger when Attribute x goes from x=2 to x=1, and at no other time.
If you touch the screen with one finger, I want that to be "Touch 1". TouchTracker1 will spawn and constrain itself to that first touch.
If you place a second finger down on the screen, I want that to be "Touch 2." TouchTracker2 will spawn and constrain its coordinates to that second touch location.
If you remove your first finger from the screen, I want TouchTracker1 to destroy, but TouchTracker2 to still be alive and active.
I made some actors that I figured I'd just constrain the coordinates of:
Actor1 X,Y to Touch 1 -> X & Y
Actor2 X,Y to Touch 2 -> X & Y
etc etc.
However I'm running into some trouble.
I have an Actor that spawns these TouchTrackers using Devices>Touch>Count.
Rule:
When Attribute>Devices>Touch>Count = 1
Spawn: TouchTracker1 at the coordinates of Touch1 X/Y
And in TouchTracker1:
Rule:
Actor Receives event Touch released >Destroy Actor
Otherwise:
Constrain coordinates to Touch 1 X, Y.
However, this doesn't even work with the singular case. Pressing a single finger down spawns the actor and constrains it to your moving touch correctly... but lifting your finger doesn't destroy the actor.
This doesn't even account for the case of having TWO TouchTrackers. It'd work until you lifted Touch 1. Then because Devices>Touch>Count went from being 2 to 1, it'd respawn TouchTracker1. BLARGH.
!) Anyone have any suggestions for getting TouchTracker to properly destroy upon touch release? Why is that not triggering?
2) Is there a way to create a rule that tracks an Attribute TRANSITIONING from one value to another? Seems like a pretty basic game engine thing -> Rule: Trigger when Attribute x goes from x=2 to x=1, and at no other time.
Answers
if actor receives touch inside
...
OTHERWISE
destory actor
Send and Receive Data using your own Server Tutorial! | Vote for A Long Way Home on Steam Greenlight! | Ten Years Left
UGH
the issue is, touch is pressed is not triggered unless you press down on the actual block, so when you spawn or move the actor to your touch point, it doesn't trigger the touch.
I don't know if it's a bug or what
Send and Receive Data using your own Server Tutorial! | Vote for A Long Way Home on Steam Greenlight! | Ten Years Left
I revised the title of this discussion to make it more clear. I've gone through the forums looking for similar answers.. and there aren't many clear ones. It seems like if you want to do anything with multitouch, you have to prep yourself for a world of headache. Please prove me wrong!!
Have you looked at the joystick template and its multitouch logic? It isn't perfect, but in general it works fine.
Rule: SnapTo is True, and snap the stick back to the center.
Is there an actor-less layer of behaviors that I'm somehow missing here?
EX: Stick2 actor 1st Rule: Hold the control on … check the Otherwise: section
always good to add "√Otherwise:" to the name of rules that have those conditions
GS should open the Otherwise when the rule is expanded … that would be the smart thing to do!