Why are my sprites not hiding with this script?

Godot Version

4.4.1

Question

Video linked below showing script and testing of the mechanics.
The frame of the “Body” AnimatedSprite2D node is represented by the number that it shows. The value of my “color” variable is printed in the output thingy (I forget what it’s called). I’m trying to have the right arrow disappear when the value of “color” is 3, to prevent the value becoming 4 or any higher number. The left arrow should also disappear when the value of “color” is 0, to prevent the value becoming a negative number.

Essentially, since there are only frames 0 thru 3, I’m trying to make sure that the value of the “color” variable doesn’t exceed that range.

Any help is appreciated, thanks.

_ready() gets called once, at the beginning of the object’s life. Your test is in that code. You probably want that test in _process(), which gets called every frame.

1 Like