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.
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
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.