Attention | Topic was automatically imported from the old Question2Answer platform. | |
Asked By | Fafale |
I want to set a Label’s text to a specific variable’s value and this variable keeps changing throughout the entire game, but it always varies according to a equation.
export var chosen_ability = 'dash'
var dash_status = str(stepify(dash_cooldown/60, 0.0001)) + 'seconds'
var explosion_status = str(stepify(explosion_radius/100, 0.01)) + 'meters'
var ability_status_label = get(chosen_ability + '_status')
func _process(delta):
$Label.text = ability_status_label
The problem is, even if dash_status
changes, ability_status_label
won’t change (Consequently, the label won’t change either) because it only gets the first calculated value of the equation.
And I can’t set the value directly because the equation changes according to the selected Ability.
So, my question is: Is there any way that I can set ability_status_label
to the EQUATION itself, and not the RESULT? With that, I could just set it to a specific equation and have it calculating itself for the rest of the game.
E.g: Instead of changing a variable to 3
(Result), change it to 6/2
(Calculation).