Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 17 additions & 2 deletions Scenes/sink.tscn
Original file line number Diff line number Diff line change
@@ -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"]
Expand All @@ -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")
Expand All @@ -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"]
19 changes: 13 additions & 6 deletions Scripts/sink.gd
Original file line number Diff line number Diff line change
Expand Up @@ -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)