Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- extends Control
- signal bar_filled
- var disabled := false
- @onready var texture_progress_bar := %TextureProgressBar
- func _ready() -> void:
- hide()
- if Input.is_action_pressed("reset"):
- disabled = true
- func _unhandled_input(event: InputEvent) -> void:
- if disabled:
- if event.is_action_released("reset"):
- disabled = false
- elif event.is_action("reset"):
- texture_progress_bar.value += texture_progress_bar.step * 3.0
- func _physics_process(delta: float) -> void:
- if disabled:
- return
- if Input.is_action_pressed("reset"):
- show()
- elif texture_progress_bar.value > 0.0:
- texture_progress_bar.value -= texture_progress_bar.step * delta * 100.0
- else:
- hide()
- func _on_texture_progress_bar_value_changed(value: float) -> void:
- if value == 100.0:
- bar_filled.emit()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement