feat: add switch node; add user interaction logic with signals to the switch node;

This commit is contained in:
2026-09-20 15:18:29 +02:00
parent 525f6c04db
commit 15bac3c653
4 changed files with 74 additions and 1 deletions
+45
View File
@@ -0,0 +1,45 @@
[gd_scene format=3 uid="uid://bdu180bpjrn5h"]
[ext_resource type="Script" uid="uid://t4xp5st31yvj" path="res://Scenes/Switch/switch.gd" id="1_c5yrt"]
[ext_resource type="Texture2D" uid="uid://c0v63n2kjtvvu" path="res://Ninja Adventure - Asset Pack/Backgrounds/Tilesets/TilesetDungeon.png" id="1_g65jv"]
[sub_resource type="RectangleShape2D" id="RectangleShape2D_3rdvi"]
size = Vector2(16, 8)
[sub_resource type="AtlasTexture" id="AtlasTexture_c5yrt"]
atlas = ExtResource("1_g65jv")
region = Rect2(64, 32, 16, 16)
[sub_resource type="AtlasTexture" id="AtlasTexture_sln40"]
atlas = ExtResource("1_g65jv")
region = Rect2(48, 32, 16, 16)
[sub_resource type="SpriteFrames" id="SpriteFrames_chgu2"]
animations = [{
"frames": [{
"duration": 1.0,
"texture": SubResource("AtlasTexture_c5yrt")
}],
"loop": 1,
"name": &"activated",
"speed": 5.0
}, {
"frames": [{
"duration": 1.0,
"texture": SubResource("AtlasTexture_sln40")
}],
"loop": 1,
"name": &"deactivated",
"speed": 5.0
}]
[node name="Switch" type="StaticBody2D" unique_id=78052327 groups=["interactable"]]
script = ExtResource("1_c5yrt")
[node name="CollisionShape2D" type="CollisionShape2D" parent="." unique_id=1474874931]
position = Vector2(0, 4)
shape = SubResource("RectangleShape2D_3rdvi")
[node name="AnimatedSprite2D" type="AnimatedSprite2D" parent="." unique_id=1373433038]
sprite_frames = SubResource("SpriteFrames_chgu2")
animation = &"activated"