Problem with touch released
ChillBox
Member, PRO Posts: 115
hi all,
I have a problem with this rule.
http://img846.imageshack.us/img846/9785/screenshot20130107at320.png
if touch released but the attribute "coins" is less then 1000 so nothing it's happening,
but when the attribute "coins" is more then 1000 the rule is happening without touch released.
because i touche released earlier. (It's like the "release" were saved.)
I want that when touch is released and its more then 1000 coins that the rule will happen.
Sorry if my English was shaky.
I have a problem with this rule.
http://img846.imageshack.us/img846/9785/screenshot20130107at320.png
if touch released but the attribute "coins" is less then 1000 so nothing it's happening,
but when the attribute "coins" is more then 1000 the rule is happening without touch released.
because i touche released earlier. (It's like the "release" were saved.)
I want that when touch is released and its more then 1000 coins that the rule will happen.
Sorry if my English was shaky.
Comments
Hi @talo it's probably best to nest a rule within a touch rule only if you're going to use the Otherwise section; or if there are more rules to nest; so in this case, there's no need to: try putting the two conditions together in the same rule:
When touch is released and game.coin => 1000
Play Sound
Change Image
Timer
Another way: If you did want to keep the rules nested, I think making the first Rule as When touch is pressed would work OK...
""You are in a maze of twisty passages, all alike." - Zork temp domain http://spidergriffin.wix.com/alphaghostapps
there is another way?
Hi, did you try it with the two conditions in the same Rule?:
When touch is released and game.coin => 1000
Play Sound
Change Image
Timer
""You are in a maze of twisty passages, all alike." - Zork temp domain http://spidergriffin.wix.com/alphaghostapps
While I too had difficulties understanding this is the right behavior. When an actor is released it stays released.
The workaround for you would be
Add a real attribute and name it Releasetime
Then a rule:
When actor is touched change attribute Releasetime to self.time
Then make a rule:
(All)
When actor is released
When self.time is < Releasetime + 0.2
When coins >= 1000
Do something
I am doing this from memory so I hope the above is correct.
Lump Apps and My Assets
Boolean called "Pressed"
rule 1
when touch is pressed
change self.attribute "Pressed" to true
Rule 2
conditions :
*if touch is released
* self.attribute Pressed is true
*coins => then 1000
Then add a timer
after 0 secs (run to completion checked)
what ever you want to happen followed by
change self.attribute "Pressed" to false
its good to have this within a timer because, lets say this is your action:
change game.coins to games.coin-1000
change self.attribute "Pressed" to false
if the "coins" go below 1000 (the needed amount within the rules conditions)
it won't set pressed to false without the timer because one of the conditions will no longer be true.
Both ways should work. I try to avoid timers because they consume a lot of processing speed.
Lump Apps and My Assets
and all of you guys!
Guru Video Channel | Lost Oasis Games | FRYING BACON STUDIOS
Thanks for the posts. I just ran into this issue. I thought it might have been a bug. Thanks for the work around. I'm going to try them in my current game.
David C. Russell, Ed.M.
Founder / President / Owner
Advenire Software, LLC