Touch is pressed rule
I have an actor that is constrained to my mouse x and y position once it is pressed on. It is a word game that you move the pieces around on a grid. You move them by pressing on one piece and dragging the constrained piece to another spot on the grid. When you release the piece it "snaps" into place based on a grid. Every spot of the grid has a piece in it so when you move one piece to a new spot the piece that is in that new spot will interpolate to the spot where the selected piece came from. This all works great but I want to make it so that when the pieces are interpolating to their new spots the player cant select the pieces that are moving. I have a rule that when the pieces are interpelating set cantClick to true. The rule I have to select a piece is then set up as follows; if touch is pressed & mouse button is down & cantClick is false = select the piece (which has constrain rules in it). This works unless I press on the piece when its moving into place and hold the mouse button down. When cantClick becomes false the piece constains to my mouse x and y. So basically I dont want to be able to select the pieces while cantClick is true. But if I clicked on a piece & hold the mouse button down when cantClick is true and then cantClick becomes false the rule fires. I tried nesting the rules a bunch of different ways and that didnt work. I am just trying to understand how the touch is pressed works. Thanks
SocializeTwitter , **My Site ** **Play Loop Zen Free **iOS HERE, Google Play HERE
Comments
Hi @app_sauce first to say you don't need when touch is pressed as well as when mouse button is down.
So just have when mouse touch is pressed
Nested Rule: When CantClick is false
constrain x
contrain y
otherwise
--nothing or whatever else you need here when true--
I know you said you tried lots of ways to nest the rules, maybe you didn't try this one...
""You are in a maze of twisty passages, all alike." - Zork temp domain http://spidergriffin.wix.com/alphaghostapps
@gyroscope I did try this it still doesnt work how I'd like it. What seems to be happening is when the piece is not in position cantClick is true. But, if I click on the piece when it is out of position and cantClick is true once the piece is in position and cantClick is false it still has the press registered and then the rule fires off. I don't know if this is an issue with the interpolation rule or what.
SocializeTwitter , **My Site ** **Play Loop Zen Free **iOS HERE, Google Play HERE
no its still happening when I change my interpolates to move to
SocializeTwitter , **My Site ** **Play Loop Zen Free **iOS HERE, Google Play HERE
I think what I am really asking is how to turn off the ability to not register a Touch is Pressed until another rule happens. So if the actor is pressed while cantClick is true nothing should happen.
SocializeTwitter , **My Site ** **Play Loop Zen Free **iOS HERE, Google Play HERE
Try adding a "when mouse button is up" in the rule that switches CantClick to false. That way it only switches to false when the screen is not touched.
Mental Donkey Games
Website - Facebook - Twitter
Thanks man! it worked! I still don't understand the order of execution and why it didn't work the first time.
SocializeTwitter , **My Site ** **Play Loop Zen Free **iOS HERE, Google Play HERE
I´m not very good at explaining things, but i´ll try...
You have 3 conditions for the constrains to happen:
-Touch is pressed
-Mouse button down
-CantClick is false
What you had before, was when the actor was interpolating and you touched it, the first 2 conditions became true. Now when the interpolation was complete, CantClick switched to false, witch made all 3 conditions true and the constrains immediately kicked in.
Now you added the "when mouse button is up" condition to the rule that switched the CantClick to false, so even if you touched the actor when it was interpolating, all 3 conditions would not become true unless you take your finger off the screen first, and then touch the actor again.
I´m not sure that made any sense to you, but i tried
Mental Donkey Games
Website - Facebook - Twitter
A press shouldn't stay registered.
Guru Video Channel | Lost Oasis Games | FRYING BACON STUDIOS
What do you mean?
If you touch an actor, it stays touched even if you move your finger outside the actor. It gets released when you take your finger off the screen.
Mental Donkey Games
Website - Facebook - Twitter
Oh okay. I thought he was saying he touched it and lifted his finger and it stayed. My mistake.
Guru Video Channel | Lost Oasis Games | FRYING BACON STUDIOS