Lock isn't working.
I have an attribute called "lock" and it is a boolean set to true. I have it so when "lock" is true and "coins" is >/= 10 when touch is released change attribute game.lock to false. This works while I am in the scene and only takes the 10 coins once, but when I go out of the scene and back into the same scene it is locked again. I tried putting save attribute and load attribute in it to see if it made a difference, but it did the same thing. Thank you for the help.
Best Answer
-
AlchimiaStudios Posts: 1,069
@Cowuniverse said:
Ignore the attribute named can.The problem is that your changing coins, a condition needed to run the rule in first place; to a value no longer at the required amount for the rule to run, so it stops. the change lock will do the same if you switch order.
A fix would be to put both in a timer of 0 seconds with run to completion checked. This way it will complete the actions regardless of the rule conditions no longer being valid.
Answers
Ignore the attribute named can.
Also, not sure if this makes any difference or not in terms of performance, but you can put multiple conditions into a single rule set by hitting the plus button on right side of the conditions line at the top of a rule.
Follow us: Twitter - Website
I put the timers in coins and lock1 at 0 seconds set to after and run to complation is chaecked, but nothing changed.
upload another screenshot of how it looks now.
Follow us: Twitter - Website
Check if the rule is actually changing it then, that will eliminate one possible factor.
Do a display text of the Game.Lock attribute, that should give you the information of wether it is changing properly to false when coins are >/= 10. If it is changing properly then some other rule or behavior is interfering with your logic upon scene start. If not then it is the rule itself.
Follow us: Twitter - Website
Thank for the help. What I did to make it work was in the same scene I made a new attribute to update lock1 to false if it equals 1.