Example. Create a progress bar and a sprite as children of a node then add this to a script for the sprite:
extends Sprite
func _ready():
position = get_node("../ProgressBar").get_rect().position
func _process(delta):
# inc the value of the progress bar
get_node("../ProgressBar").value += 1
# set the sprite's x position according to value of the bar:
# you need to scale 'value according in the following line...
position.x = get_node("../ProgressBar").get_rect().position.x + get_node("../ProgressBar").value
As the comment says, you’ll know the x length of the bar so you can calculate a factor to adjust the x position.
Cool. This works with the standard progress bar, but how would I do this with a TextureProgress? Im getting this: Attempt to call function ‘get_rect’ in base ‘null instance’ on a null instance.
StraightUpGruntled | 2018-07-01 00:13
Nevermind.
I accidentally made the Sprite the child of the TextureProgress.