summaryrefslogtreecommitdiff
path: root/Scenes/Entities/Objects
diff options
context:
space:
mode:
authorDaniel Weipert <git@mail.dweipert.de>2024-05-03 09:32:22 +0200
committerDaniel Weipert <git@mail.dweipert.de>2024-05-03 09:32:22 +0200
commit516d22c1737a9c94026b5ff0c9856bc5549aa416 (patch)
treecd9ef3089d1c8bdfc440b5673f7ad0d0dce787a9 /Scenes/Entities/Objects
parentd192b1546ab39180cdc28d2621c117539e3d26d6 (diff)
update
Diffstat (limited to 'Scenes/Entities/Objects')
-rw-r--r--Scenes/Entities/Objects/Box.tscn1
-rw-r--r--Scenes/Entities/Objects/Button.gd13
-rw-r--r--Scenes/Entities/Objects/Button.tscn50
-rw-r--r--Scenes/Entities/Objects/Wood.tscn22
4 files changed, 86 insertions, 0 deletions
diff --git a/Scenes/Entities/Objects/Box.tscn b/Scenes/Entities/Objects/Box.tscn
index 2e02d75..eda0e6a 100644
--- a/Scenes/Entities/Objects/Box.tscn
+++ b/Scenes/Entities/Objects/Box.tscn
@@ -88,6 +88,7 @@ _data = {
}
[node name="Box" type="StaticBody2D"]
+texture_filter = 1
collision_layer = 8
collision_mask = 32
script = ExtResource("1_owgyi")
diff --git a/Scenes/Entities/Objects/Button.gd b/Scenes/Entities/Objects/Button.gd
new file mode 100644
index 0000000..f028440
--- /dev/null
+++ b/Scenes/Entities/Objects/Button.gd
@@ -0,0 +1,13 @@
+extends Area2D
+
+
+signal pressed
+
+var is_pressed: bool = false
+
+
+func _on_body_entered(body):
+ if body is Player and not is_pressed:
+ is_pressed = true
+ $AnimatedSprite2D.play("pressed")
+ emit_signal("pressed")
diff --git a/Scenes/Entities/Objects/Button.tscn b/Scenes/Entities/Objects/Button.tscn
new file mode 100644
index 0000000..0416167
--- /dev/null
+++ b/Scenes/Entities/Objects/Button.tscn
@@ -0,0 +1,50 @@
+[gd_scene load_steps=7 format=3 uid="uid://8fbkdifli6ic"]
+
+[ext_resource type="Script" path="res://Scenes/Entities/Objects/Button.gd" id="1_83jjd"]
+[ext_resource type="Texture2D" uid="uid://b6ce2eihxulqb" path="res://Assets/Stages/core_set pieces.png" id="2_frejs"]
+
+[sub_resource type="RectangleShape2D" id="RectangleShape2D_xgggr"]
+size = Vector2(12, 7)
+
+[sub_resource type="AtlasTexture" id="AtlasTexture_t47kb"]
+atlas = ExtResource("2_frejs")
+region = Rect2(272, 512, 16, 16)
+
+[sub_resource type="AtlasTexture" id="AtlasTexture_6om1g"]
+atlas = ExtResource("2_frejs")
+region = Rect2(288, 512, 16, 16)
+
+[sub_resource type="SpriteFrames" id="SpriteFrames_moi56"]
+animations = [{
+"frames": [{
+"duration": 1.0,
+"texture": SubResource("AtlasTexture_t47kb")
+}],
+"loop": false,
+"name": &"default",
+"speed": 1.0
+}, {
+"frames": [{
+"duration": 1.0,
+"texture": SubResource("AtlasTexture_6om1g")
+}],
+"loop": false,
+"name": &"pressed",
+"speed": 1.0
+}]
+
+[node name="Button" type="Area2D"]
+z_index = -1
+collision_layer = 64
+collision_mask = 2
+script = ExtResource("1_83jjd")
+
+[node name="CollisionShape2D" type="CollisionShape2D" parent="."]
+position = Vector2(0, 1.5)
+shape = SubResource("RectangleShape2D_xgggr")
+
+[node name="AnimatedSprite2D" type="AnimatedSprite2D" parent="."]
+texture_filter = 1
+sprite_frames = SubResource("SpriteFrames_moi56")
+
+[connection signal="body_entered" from="." to="." method="_on_body_entered"]
diff --git a/Scenes/Entities/Objects/Wood.tscn b/Scenes/Entities/Objects/Wood.tscn
new file mode 100644
index 0000000..23ba656
--- /dev/null
+++ b/Scenes/Entities/Objects/Wood.tscn
@@ -0,0 +1,22 @@
+[gd_scene load_steps=3 format=3 uid="uid://b2xpm8k3chbae"]
+
+[ext_resource type="Texture2D" uid="uid://cctukh2hhfgty" path="res://Assets/Stages/core_outdoor_nature.png" id="1_khy0w"]
+
+[sub_resource type="CapsuleShape2D" id="CapsuleShape2D_1je2f"]
+radius = 7.0
+height = 60.0
+
+[node name="Wood" type="StaticBody2D"]
+z_index = -1
+y_sort_enabled = true
+collision_layer = 8
+collision_mask = 30
+
+[node name="Sprite2D" type="Sprite2D" parent="."]
+texture_filter = 1
+texture = ExtResource("1_khy0w")
+region_enabled = true
+region_rect = Rect2(912, 0, 16, 64)
+
+[node name="CollisionShape2D" type="CollisionShape2D" parent="."]
+shape = SubResource("CapsuleShape2D_1je2f")