Tshirtbooths Drag and Drop tutorial- glitch of sometimes object stays in place after release with a

Hello, I could really use some help. My game is one glitch fix from being submitted to Apple.
Ok, here's what is happening. I used Tshirtbooths tutorial on Drag and Drop (nice tutorials by the way). But I added a rule that says..
when actor touch is released
accelerrate down by 300 (gravity is turned on)
collide with floor
What is happening is that it works perfect on the Mac, but on the device (actual .ipa app on device not the GameSalad viewer), sometimes
the rule for the gravity accelerate down does not take place. Instead the object is stuck where ever you released it, at what ever x/y cordiantes it may be.
I've tried adding the same rule to "Otherwise", although it has made it happen less. I can still get it to rear it's ugly head.
Anyone have any suggestions on how to get the gravity to take over and never let it get stuck to the x/y of where you drag it (always falls, when released)?
Ok, here's what is happening. I used Tshirtbooths tutorial on Drag and Drop (nice tutorials by the way). But I added a rule that says..
when actor touch is released
accelerrate down by 300 (gravity is turned on)
collide with floor
What is happening is that it works perfect on the Mac, but on the device (actual .ipa app on device not the GameSalad viewer), sometimes
the rule for the gravity accelerate down does not take place. Instead the object is stuck where ever you released it, at what ever x/y cordiantes it may be.
I've tried adding the same rule to "Otherwise", although it has made it happen less. I can still get it to rear it's ugly head.
Anyone have any suggestions on how to get the gravity to take over and never let it get stuck to the x/y of where you drag it (always falls, when released)?
Comments
And I assume you are using scene gravity, and not an accelerate down behavior on the actors on the stage? If you are using scene gravity, any move attribute down you add to it is going to make it go that much faster with the scene gravity.
How would I script it to unlock the constrain?
When touch is Pressed
-Constrain x
-Constrain Y
Otherwise
Accelerate down
I would leave the collide outside of a rule by itself unless there is some reason you would ever want it to not collide.
Also notice the accelerate is inside the otherwise by itself. not a rule inside the otherwise.
You may possibly want to try using change attributes X&Y when touch is released instead of constrain attributes, since you are wanting it to fall, using a constrain is going to constantly force the actor to stay in that spot.
If that doesn't work, you can fandango the script. - When touch is released TIMER for .5 seconds - change attribute.linear velocity Y to -20(or any number that works better) That will release it from the constraint, and let the gravity take over in the scene. But that method is like using duct tape on a pressurized radiator hose that has a leak.
Edit: @tenrdrmer method is probably better, actually.
I've tried both tenrdrmer idea and SlickZero's idea. But neither is working the way I need it to. tenrdrmer's idea would knock the draggable object off the actor carrying it beofre you would get a chance to drag it, so that will not work. SlickZero's ideas changing the constrain to a change attribute of the self and Game X/Y would actually make it stop where ever you drop the item and then not be able to drag it again. And the patch idea, is not much different that what I've got now.
Anyother ideas that might help. The original problem of sometime (not everytime) the draggable item will get stuck at what ever x/y position that you drop it, instead of gravity taking over and dropping to the ground like it should. I'm pretty sure that SlickSero hit the head on the nail with the it being related to the constrain to moue position x/y. Just need a different way of telling it to unconstrain when touch is released.
Anyother guesses?
-accelerate down
And have the collide behavior for the floor seperate not in any rule
First off thanks to everyone above for their great ideas on how to fix this issue. My hats off to JohnPapiomitis, although your idea didn't work the way I need it to, it did how ever spark and idea for a solution! Once again thanks to everyone I teied each idea out and they all helped in getting me to think about the problem a little differently.
The solution was so freakn easy. As I tested the ideas above I started to notice that I could only get the item stuck if it was up on the same horizontal space as my score. Everywhere else it worked as it should touch is released fall with gravity, but up there it would stick to where ever you let go floating in the air till you drug it off.
So, I put an invisible rectangle up there across the area that the items where getting stuck at and made a rule fr each actor/item
If touch is relased and overlaps or collides with invisible box, accelerate down.
So far so good, been testing it and now I can not reproduce the glitch at all!
That was my final glitch to fix, and I'm now getting ready to submit it to Apple!!!
\:D/ Woot Woot!!! :-bd