Rule: Change Attribute +Value *Works only occasionally* Help

BrackAttackBrackAttack Member Posts: 22
edited February 2013 in Working with GS (Mac)
I have a simple rule within a moving character:

If (self.position.x) is greater than (self.position.custom_x)+20,
Then change attribute (self.position.custom_x) to (self.position.x)

It works! it doesn't work! It starts working at random times! I can't figure out why this doesn't work consistently all the time.

The idea is that I want the game to reset my custom attribute with the current x potion whenever that x position value increases (or decreases) past a threshold.

The only other characters in my scene are a background image and walls, and some basic other rules that don't influence this rule set. Using gamesalad ver 0.10.1 beta for mac OSX. Any suggestions?

Comments

  • MantoManto Member Posts: 796
    This might be what you're looking for. I think your problem is that custom_x is not set to self.position.x at start and that's why it doesn't update all the time.
  • BrackAttackBrackAttack Member Posts: 22
    Previously the custom value started at zero...I didn't think it mattered because the x position was always greater then 0+20...

    So as you suggested, I placed a "change attribute" (self.position.custom_x) to (self.position.x) into the actor at the top of the rules.

    Sure enough, so far so good, it has been working from the start now.

    So a zero didn't trigger the event for some reason?

    Thank you.
  • MantoManto Member Posts: 796
    @BrackAttack For some reason if the rule is triggered at start it's not going to be trigger anymore, but if it starts without been triggered it works.
Sign In or Register to comment.