Reputation: 11
Can I make a progress bar like where the value is just a little image that travels to the end of progress bar in Godot?
I was trying to do something like this:
If anyone who knows some way to do this without framing every possible value, please tell me how.
Upvotes: 1
Views: 618
Reputation: 96
You could create a new scene, with a line2d as its root, and a sprite (with whatever texture you want) as its child. You can set up the line with these properties and could set the image like so. Then all you would need to do is attach a script to the line and increment the x position of the sprite over time. I wrote a script example for you here, but depending on your use case you may want to adjust some things or make some of the variables dynamic.
extends Line2D
var maxSteps = 100
var count = 0
var step = 1
onready var sprite = get_node("Sprite")
func do_step():
if count < maxSteps:
sprite.global_position.x += step
count += step
Upvotes: 0