Attention | Topic was automatically imported from the old Question2Answer platform. | |
Asked By | MadTinkerer |
I found an answer for this question for 3.x, but I can’t find an answer for this in 4.x.
In GDScript I have a child class of ProgressBar I’m calling GradientBar because I want the “fill” StyleBox to change bg_color when the GradientBar’s value is changed. Changing the color is not the problem, but I can’t figure out the syntax to have value’s setter overidden.
If you’re defining your own variable it’s simple:
var own_variable : float:
get:
return own_variable
set(amount):
some_code()
own_variable = amount
But if you try to do that with a variable of a parent class the IDE says something like “Member “value” redefined (original in native class ‘ProgressBar’)”.
I’m surprised there isn’t an answer to this. I guess I’ll just have to connect the “value changed” signal to itself like a barbarian.
MadTinkerer | 2022-11-19 16:53