|Topic was automatically imported from the old Question2Answer platform.
I’m a total noob, so sorry if this is impossible or super basic. I’m trying to make a game where you have a limited number of jumps, I want to show the number of jumps left on the screen. To do this, my idea is to have a bunch of sprites with numbers written on them, with the lowest at the bottom, and the highest at the top. So when you jump, the highest number disappears, revealing the number that’s smaller by one. I want to do this by having the sprites be named the number they are, and then making the sprite with the name of the number_of_jumps_left variable turn invisible. How can I make an integer a variable, so I can do this? If this is impossible, what’s a better way to implement this mechanic?
Here’s some rough code of what I’m trying to do.
var number_of_jumps_left = 10
func _physics_process(delta) -> void:
number_of_jumps_left.visible = false
number_of_jumps_left -= 1