50 lines
1.5 KiB
GDScript
50 lines
1.5 KiB
GDScript
extends TextureRect
|
|
|
|
|
|
func start_flashing():
|
|
%AnimationPlayer.play("flashing")
|
|
|
|
|
|
func stop_flashing():
|
|
%AnimationPlayer.play("RESET")
|
|
|
|
func _ready() -> void:
|
|
set_station("1111")
|
|
func set_station(station_0:String,station_1=null,station_2=null,station_3=null):
|
|
var tween=%station_0.create_tween()
|
|
tween.tween_property(%station_0,"modulate:a",0,0.5)
|
|
tween.tween_callback(%station_0.set.bind("text",station_0))
|
|
tween.tween_property(%station_0,"modulate:a",1,0.5)
|
|
|
|
var next_tween=%station_1.create_tween()
|
|
next_tween.tween_property(%station_1,"modulate:a",0,0.5)
|
|
if station_1 is String:
|
|
next_tween.tween_callback(%station_1.set.bind("text",station_1))
|
|
next_tween.tween_property(%station_1,"modulate:a",1,0.5)
|
|
|
|
next_tween=%station_2.create_tween()
|
|
next_tween.tween_property(%station_2,"modulate:a",0,0.5)
|
|
if station_2 is String:
|
|
next_tween.tween_callback(%station_2.set.bind("text",station_2))
|
|
next_tween.tween_property(%station_2,"modulate:a",1,0.5)
|
|
|
|
next_tween=%station_3.create_tween()
|
|
next_tween.tween_property(%station_3,"modulate:a",0,0.5)
|
|
if station_3 is String:
|
|
next_tween.tween_callback(%station_3.set.bind("text",station_3))
|
|
next_tween.tween_property(%station_3,"modulate:a",1,0.5)
|
|
pass
|
|
|
|
|
|
func _on_button_pressed() -> void:
|
|
if %AnimationPlayer.is_playing():
|
|
stop_flashing()
|
|
else:
|
|
start_flashing()
|
|
pass # Replace with function body.
|
|
|
|
|
|
func _on_button_2_pressed() -> void:
|
|
set_station(str(randf()),str(randf()),str(randf()),str(randf()))
|
|
pass # Replace with function body.
|