• 2D
  • How do i detect when a value (float variable) goes down?

I have a label in my scene that shows the amount of money you have. I want to make it shake/turn red when the number goes down. So, how do i detect a float/int value going down? (Or change in general)

How does your script get the value to place in the label? That's one place to start.

@DaveTheCoder It just sets the value of a "money" float variable to the text of the label every frame. label.settext(str(money)) or something like that, i'm on my phone right now. I just need to know how to detect when the money variable changes (from code)> @DaveTheCoder said:

How does your script get the value to place in the label? That's one place to start.

Maybe use a setget function and/or a signal that is emitted when the value changes? Also: welcome to the forums @DoodleDev!

@TwistedTwigleg said: Maybe use a setget function and/or a signal that is emitted when the value changes? Also: welcome to the forums @DoodleDev!

Thanks! I've actually used that before but somehow didn't even know what it did.