diff options
author | Daniel Weipert <git@mail.dweipert.de> | 2024-04-14 21:49:20 +0200 |
---|---|---|
committer | Daniel Weipert <git@mail.dweipert.de> | 2024-04-14 21:49:20 +0200 |
commit | f27937e6e9b6a7146dd09fc711d2d293ecf5abbf (patch) | |
tree | e0ddd5e6d356000e4f29af6211a736284a4972ee /Scenes/Entities/Objects | |
parent | 96d36cee33d6321834565f0a5d412ef95c5ceffd (diff) |
update
Diffstat (limited to 'Scenes/Entities/Objects')
-rw-r--r-- | Scenes/Entities/Objects/Box.tscn | 33 | ||||
-rw-r--r-- | Scenes/Entities/Objects/Sign.gd | 20 | ||||
-rw-r--r-- | Scenes/Entities/Objects/Sign.tscn | 21 |
3 files changed, 58 insertions, 16 deletions
diff --git a/Scenes/Entities/Objects/Box.tscn b/Scenes/Entities/Objects/Box.tscn index 6acb93f..c549618 100644 --- a/Scenes/Entities/Objects/Box.tscn +++ b/Scenes/Entities/Objects/Box.tscn @@ -6,22 +6,6 @@ [sub_resource type="RectangleShape2D" id="RectangleShape2D_rwppg"] size = Vector2(16, 16) -[sub_resource type="Animation" id="Animation_ihbs5"] -resource_name = "breaking" -length = 0.2 -tracks/0/type = "value" -tracks/0/imported = false -tracks/0/enabled = true -tracks/0/path = NodePath("Sprite2D:modulate") -tracks/0/interp = 1 -tracks/0/loop_wrap = true -tracks/0/keys = { -"times": PackedFloat32Array(0, 0.1, 0.2), -"transitions": PackedFloat32Array(1, 1, 1), -"update": 0, -"values": [Color(1, 1, 1, 1), Color(1, 1, 0, 1), Color(1, 0, 0, 1)] -} - [sub_resource type="Animation" id="Animation_5u23n"] length = 0.001 tracks/0/type = "bezier" @@ -81,6 +65,22 @@ tracks/4/keys = { "values": [Color(1, 1, 0, 1)] } +[sub_resource type="Animation" id="Animation_ihbs5"] +resource_name = "breaking" +length = 0.2 +tracks/0/type = "value" +tracks/0/imported = false +tracks/0/enabled = true +tracks/0/path = NodePath("Sprite2D:modulate") +tracks/0/interp = 1 +tracks/0/loop_wrap = true +tracks/0/keys = { +"times": PackedFloat32Array(0, 0.1, 0.2), +"transitions": PackedFloat32Array(1, 1, 1), +"update": 0, +"values": [Color(1, 1, 1, 1), Color(1, 1, 0, 1), Color(1, 0, 0, 1)] +} + [sub_resource type="AnimationLibrary" id="AnimationLibrary_cqvgo"] _data = { "RESET": SubResource("Animation_5u23n"), @@ -96,6 +96,7 @@ script = ExtResource("1_owgyi") shape = SubResource("RectangleShape2D_rwppg") [node name="Sprite2D" type="Sprite2D" parent="."] +modulate = Color(1, 1, 0, 1) texture = ExtResource("1_yqw0v") region_enabled = true region_rect = Rect2(144.052, 208.08, 16, 16) diff --git a/Scenes/Entities/Objects/Sign.gd b/Scenes/Entities/Objects/Sign.gd new file mode 100644 index 0000000..9d83bab --- /dev/null +++ b/Scenes/Entities/Objects/Sign.gd @@ -0,0 +1,20 @@ +extends StaticBody2D + + +signal interacted + +var interaction_area: Area2D + + +func _ready(): + add_to_group("interactables") + + interaction_area = Utilities.Collision.Area.new(self, $CollisionShape2D) + add_child(interaction_area) + + +func _physics_process(_delta): + if Input.is_action_just_pressed("ui_accept") and interaction_area.has_overlapping_areas(): + for area in interaction_area.get_overlapping_areas(): + if area.is_in_group("player"): + emit_signal("interacted") diff --git a/Scenes/Entities/Objects/Sign.tscn b/Scenes/Entities/Objects/Sign.tscn new file mode 100644 index 0000000..847b768 --- /dev/null +++ b/Scenes/Entities/Objects/Sign.tscn @@ -0,0 +1,21 @@ +[gd_scene load_steps=4 format=3 uid="uid://gvsyy1b1pq53"] + +[ext_resource type="Script" path="res://Scenes/Entities/Objects/Sign.gd" id="1_gowid"] +[ext_resource type="Texture2D" uid="uid://b6ce2eihxulqb" path="res://Assets/Stages/core_set pieces.png" id="2_us5wr"] + +[sub_resource type="RectangleShape2D" id="RectangleShape2D_5hdba"] +size = Vector2(14, 17) + +[node name="Sign" type="StaticBody2D"] +collision_layer = 8 +collision_mask = 6 +script = ExtResource("1_gowid") + +[node name="CollisionShape2D" type="CollisionShape2D" parent="."] +position = Vector2(0, 0.5) +shape = SubResource("RectangleShape2D_5hdba") + +[node name="Sprite2D" type="Sprite2D" parent="."] +texture = ExtResource("2_us5wr") +region_enabled = true +region_rect = Rect2(208.674, 94.2419, 14.7292, 17.7021) |