Attention | Topic was automatically imported from the old Question2Answer platform. | |
Asked By | Regret |
Im doing a game for a project for my school:
I wanted a progress that will fill up by repeatedly pressing the interaction key
Attention | Topic was automatically imported from the old Question2Answer platform. | |
Asked By | Regret |
Im doing a game for a project for my school:
I wanted a progress that will fill up by repeatedly pressing the interaction key
Reply From: | kidscancode |
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
THANK YOU VERY MUCHH but it would instantly fill up when I hold the Z key (interaction button) any suggestion how to fix that?
Regret | 2019-12-03 02:35
When holding a key, your OS typically sends a key echo. You can check for echo
and ignore it. See InputEventKey.
kidscancode | 2019-12-03 02:38