#TextureProgressBar how to reset value

6 messages · Page 1 of 1 (latest)

tulip spoke
#

Are the two lines

#$CanvasLayer/UI/TextureProgressBar.value = shield_value
#$CanvasLayer/UI/TextureProgressBar.update_shield()

meant to be commented out?:)

It seams like you could write something like:
$CanvasLayer/UI/TextureProgressBar.value = the_value_u_want
under new_game()?

tropic saffron
#

Yes. I commented that because the first one yes it refill the progress bar visually but my player is being killed by only 1 bullet it must be 8-10 bullets before completely depleted.
The second gives error "Invalid call. Nonexistent function 'update_shield' in base 'TextureProgressBar'."

autumn crag
#

Do you have e that function anywhere?

tropic saffron
#

This is the full code content from other scene where update_shield() is.

extends MarginContainer

func update_score(value):
$ScoreLabel.text = "Score: %s" % value

func update_shield(max_value, value):
$TextureProgressBar.max_value = max_value
$TextureProgressBar.value = value

autumn crag
#

So the function is in the MarginContainer, not in the bar

#

One important tip: create a variable to reference your nodes in your class. It makes your code easier to read since you don’t have to write those long paths