diff --git a/Scenes/sink.tscn b/Scenes/sink.tscn index 28c867d..9dc7e48 100644 --- a/Scenes/sink.tscn +++ b/Scenes/sink.tscn @@ -1,4 +1,4 @@ -[gd_scene load_steps=5 format=3 uid="uid://whu4rwgsyl8u"] +[gd_scene load_steps=6 format=3 uid="uid://whu4rwgsyl8u"] [ext_resource type="Texture2D" uid="uid://cgnmmfc1l4d5d" path="res://2D Assets/sinks/sink.png" id="1_0ywo5"] [ext_resource type="Script" path="res://Scripts/SinkClick.gd" id="2_16xt0"] @@ -7,6 +7,13 @@ [sub_resource type="RectangleShape2D" id="RectangleShape2D_7l3ci"] size = Vector2(443.333, 408.333) +[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_circle"] +bg_color = Color(0, 1, 0, 1) +corner_radius_top_left = 50 +corner_radius_top_right = 50 +corner_radius_bottom_right = 50 +corner_radius_bottom_left = 50 + [node name="Sink" type="Sprite2D"] position = Vector2(946.667, 863.333) texture = ExtResource("1_0ywo5") @@ -20,4 +27,12 @@ script = ExtResource("2_16xt0") position = Vector2(0, -5.83331) shape = SubResource("RectangleShape2D_7l3ci") -[connection signal="area_entered" from="Area2D" to="Area2D" method="_on_area_entered"] +[node name="IndicatorLight" type="Panel" parent="."] +offset_left = -25.0 +offset_top = -25.0 +offset_right = 25.0 +offset_bottom = 25.0 +mouse_filter = 2 +theme_override_styles/panel = SubResource("StyleBoxFlat_circle") + +[connection signal="area_entered" from="Area2D" to="Area2D" method="_on_area_entered"] \ No newline at end of file diff --git a/Scripts/sink.gd b/Scripts/sink.gd index 4939319..1283476 100644 --- a/Scripts/sink.gd +++ b/Scripts/sink.gd @@ -2,12 +2,19 @@ extends Sprite2D @export var expectedType: String +@export var available: bool = true: + set(value): + available = value + if indicator_light: + indicator_light.visible = value -# Called when the node enters the scene tree for the first time. -func _ready() -> void: - pass # Replace with function body. +@onready var indicator_light: Control = $IndicatorLight +func _ready() -> void: + if indicator_light: + indicator_light.visible = available -# Called every frame. 'delta' is the elapsed time since the previous frame. -func _process(delta: float) -> void: - pass +func _process(_delta: float) -> void: + if available and indicator_light: + var time = Time.get_ticks_msec() / 200.0 + indicator_light.modulate.a = 0.6 + (sin(time) * 0.4) \ No newline at end of file