You could create a variable to store the original value of the modulate
member (suppose we call it oldModulate
), and before setting the value of modulate
to Color.red
, save the modulate as so: oldModulate = self.modulate
. Then, when the timer runs out, in your _on_StunTimer_timeout
function, you could do self.modulate = oldModulate
. This would bring it back to normal, and supports the feature to also have a custom modulate before turning red (it might be green, for example, from some other effect before it turns red). You may want to consider using a Tween
to have the red color fade out back to normal using interpolate_property
using the initial value of Color.red
and the target value as oldModulate
for your modulate
property.