0 votes

Im doing a game for a project for my school:

I wanted a progress that will fill up by repeatedly pressing the interaction key

in Engine by (29 points)

1 Answer

0 votes
Best answer

ProgressBar works by displaying a value, set by the value property. All you need to do is increase that property's value each time the key is pressed.

Have you already created the scene? Do you already know how to detect input? Your question is not very specific so it's hard to know how much information you need.

If it's just a case of how to increase the bar's display,

func _ready():
    $ProgressBar.value = 0

func _input(event):
    # Assuming you want "spacebar" to be the "interaction key"
    if event.is_action_pressed("ui_select"):
        $ProgressBar.value += 1  # or whatever amount you want
by (21,313 points)
selected by

THANK YOU VERY MUCHH but it would instantly fill up when I hold the Z key (interaction button) any suggestion how to fix that?

When holding a key, your OS typically sends a key echo. You can check for echo and ignore it. See InputEventKey.

Welcome to Godot Engine Q&A, where you can ask questions and receive answers from other members of the community.

Please make sure to read Frequently asked questions and How to use this Q&A? before posting your first questions.
Social login is currently unavailable. If you've previously logged in with a Facebook or GitHub account, use the I forgot my password link in the login box to set a password for your account. If you still can't access your account, send an email to webmaster@godotengine.org with your username.