Attention | Topic was automatically imported from the old Question2Answer platform. | |
Asked By | Tovns |
I’m very new to Godot I have an enemy that when its gets destroyed it changes a global variable by 1, the code that it is connected to checks the value and if it isn’t 0 it changes it by -1 and in that if loop thing it emits a signal to my progress bar to change its value.
extends Control
var death = 0
signal add_time
func _process(delta: float) -> void:
if death != 0:
emit_signal("add_time")
death -= 1
if death <= 0:
death = 0
And the progress bars code
extends ProgressBar
func _process(delta: float) -> void:
value -= 1 * delta
if value <= 0:
value = 0
func add_the_time():
print("added time")
value += 3
if value >= 10 :
value = 10
func _on_control_add_time() -> void:
add_the_time()