make it with time base like green click in 1.2s the yellow 0.6s just to get more good out comes here is code and all of it signals
extends Control
##make click_of_mouse insted of button you stoped so you don't need to button use mouse click you only need three click one start scend throw at end of animation shoot cannon one holde to exit
@onready var green: Timer = $green
@onready var yellow: Timer = $yellow
@onready var red: Timer = $red
@onready var boxpfstats: ColorRect = $ColorRect
@onready var exit: Timer = $exit
var greentimer: bool = false
var yellowtimer: bool = false
var redtimer: bool = false
var starthere: bool = false
# Called when the node enters the scene tree for the first time.
func _ready() -> void:
boxpfstats.color = Color.BLACK
print("hellotolevel")
func _on_button_button_down() -> void:
if !starthere:
green.start()
starthere = true
func DO_end_pressing() -> void:
startactioningaame()
func _on_green_timeout() -> void:
print("stopcalling")
greentimer = true
yellowtimer = false
redtimer = false
boxpfstats.color = Color.GREEN
changesbutweentime()
func _on_yellow_timeout() -> void:
greentimer = false
yellowtimer = true
redtimer = false
boxpfstats.color = Color.YELLOW
changesbutweentime()
func _on_red_timeout() -> void:
greentimer = false
yellowtimer = false
redtimer = true
boxpfstats.color = Color.RED
changesbutweentime()
func _on_exit_timeout() -> void:
get_tree().quit()
func startactioningaame():
green.stop()
yellow.stop()
red.stop()
exit.stop()
if greentimer:
print("greenaction")
if yellowtimer:
print("yellowaction")
if redtimer:
print("redaction")
func changesbutweentime():
if greentimer:
green.stop()
yellow.start()
if yellowtimer:
yellow.stop()
red.start()
if redtimer:
red.stop()
exit.start()