summaryrefslogtreecommitdiff
path: root/Scenes/Entities/Objects
diff options
context:
space:
mode:
authorDaniel Weipert <git@mail.dweipert.de>2024-04-22 16:34:25 +0200
committerDaniel Weipert <git@mail.dweipert.de>2024-04-22 16:34:25 +0200
commitc8a316e4b8987dad963656a34665fa0e23dedcb1 (patch)
tree569af4b4f37d21079b6aedfad5164e94b50b6cb8 /Scenes/Entities/Objects
parentf27937e6e9b6a7146dd09fc711d2d293ecf5abbf (diff)
update
Diffstat (limited to 'Scenes/Entities/Objects')
-rw-r--r--Scenes/Entities/Objects/Coin.gd6
-rw-r--r--Scenes/Entities/Objects/Coin.tscn11
-rw-r--r--Scenes/Entities/Objects/Sign.gd2
-rw-r--r--Scenes/Entities/Objects/Vines.gd53
-rw-r--r--Scenes/Entities/Objects/Vines.tscn58
5 files changed, 120 insertions, 10 deletions
diff --git a/Scenes/Entities/Objects/Coin.gd b/Scenes/Entities/Objects/Coin.gd
index 48e30b3..2bbb75c 100644
--- a/Scenes/Entities/Objects/Coin.gd
+++ b/Scenes/Entities/Objects/Coin.gd
@@ -9,10 +9,8 @@ func _ready():
add_child(collision_area)
-func hit_by_explosion():
- queue_free()
-
-
func _collide(area: Area2D):
if area.is_in_group("player"):
queue_free()
+ elif area.is_in_group("explosions"):
+ queue_free()
diff --git a/Scenes/Entities/Objects/Coin.tscn b/Scenes/Entities/Objects/Coin.tscn
index aacb70b..1025602 100644
--- a/Scenes/Entities/Objects/Coin.tscn
+++ b/Scenes/Entities/Objects/Coin.tscn
@@ -1,13 +1,14 @@
[gd_scene load_steps=4 format=3 uid="uid://cl7jri45a43t0"]
[ext_resource type="Script" path="res://Scenes/Entities/Objects/Coin.gd" id="1_kjrye"]
-[ext_resource type="Texture2D" uid="uid://5dk0c1kpvdgs" path="res://Assets/bomb_party_v4.png" id="2_0mghm"]
+[ext_resource type="Texture2D" uid="uid://b6ce2eihxulqb" path="res://Assets/Stages/core_set pieces.png" id="2_jf7cy"]
[sub_resource type="RectangleShape2D" id="RectangleShape2D_rwppg"]
size = Vector2(16, 16)
[node name="Coin" type="StaticBody2D" groups=["breakables"]]
-collision_layer = 8
+z_index = -1
+collision_layer = 64
collision_mask = 34
script = ExtResource("1_kjrye")
@@ -15,7 +16,7 @@ script = ExtResource("1_kjrye")
shape = SubResource("RectangleShape2D_rwppg")
[node name="Sprite2D" type="Sprite2D" parent="."]
-self_modulate = Color(1, 0, 1, 1)
-texture = ExtResource("2_0mghm")
+scale = Vector2(1.1, 1.1)
+texture = ExtResource("2_jf7cy")
region_enabled = true
-region_rect = Rect2(48.8626, 208.456, 15.1374, 15.5442)
+region_rect = Rect2(33.788, 376.89, 13, 13)
diff --git a/Scenes/Entities/Objects/Sign.gd b/Scenes/Entities/Objects/Sign.gd
index 9d83bab..81d3a6c 100644
--- a/Scenes/Entities/Objects/Sign.gd
+++ b/Scenes/Entities/Objects/Sign.gd
@@ -13,7 +13,7 @@ func _ready():
add_child(interaction_area)
-func _physics_process(_delta):
+func _input(event):
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"):
diff --git a/Scenes/Entities/Objects/Vines.gd b/Scenes/Entities/Objects/Vines.gd
new file mode 100644
index 0000000..ac2c249
--- /dev/null
+++ b/Scenes/Entities/Objects/Vines.gd
@@ -0,0 +1,53 @@
+extends StaticBody2D
+
+
+@export_enum("up", "down", "left", "right") var spread_direction: String = "right"
+
+
+# Called when the node enters the scene tree for the first time.
+func _ready():
+ add_to_group("hitables")
+
+ if spread_direction == "up":
+ rotate(deg_to_rad(-90))
+ elif spread_direction == "down":
+ rotate(deg_to_rad(90))
+ elif spread_direction == "left":
+ rotate(deg_to_rad(180))
+ elif spread_direction == "right":
+ rotate(deg_to_rad(0))
+
+ spread()
+
+
+# Called every frame. 'delta' is the elapsed time since the previous frame.
+func _process(_delta):
+ pass
+
+
+func spread():
+ var grow = func():
+ $CollisionShape2D.shape.size.x += 16 * $AnimatedSprite2D.frame
+
+ $AnimatedSprite2D.frame_changed.connect(grow)
+ $AnimatedSprite2D.play()
+ await $AnimatedSprite2D.animation_finished
+ $AnimatedSprite2D.frame_changed.disconnect(grow)
+
+
+func retract():
+ var shrink = func():
+ $CollisionShape2D.shape.size.x -= 16 * ($AnimatedSprite2D.frame + 1)
+
+ $AnimatedSprite2D.frame_changed.connect(shrink)
+ $AnimatedSprite2D.play_backwards()
+ await $AnimatedSprite2D.animation_finished
+ $AnimatedSprite2D.frame_changed.disconnect(shrink)
+
+ await get_tree().create_timer(3).timeout
+ spread()
+
+
+func hit_by_explosion():
+ if not $AnimatedSprite2D.is_playing():
+ retract()
diff --git a/Scenes/Entities/Objects/Vines.tscn b/Scenes/Entities/Objects/Vines.tscn
new file mode 100644
index 0000000..2fd10f8
--- /dev/null
+++ b/Scenes/Entities/Objects/Vines.tscn
@@ -0,0 +1,58 @@
+[gd_scene load_steps=9 format=3 uid="uid://ceoy1eb10tq0a"]
+
+[ext_resource type="Script" path="res://Scenes/Entities/Objects/Vines.gd" id="1_ymtv0"]
+[ext_resource type="Texture2D" uid="uid://bxl3lqlm22eem" path="res://Assets/Stages/core_outdoor.png" id="2_8tl8f"]
+
+[sub_resource type="RectangleShape2D" id="RectangleShape2D_5f74o"]
+resource_local_to_scene = true
+size = Vector2(14, 14)
+
+[sub_resource type="AtlasTexture" id="AtlasTexture_skslo"]
+atlas = ExtResource("2_8tl8f")
+region = Rect2(384, 528, 16, 16)
+
+[sub_resource type="AtlasTexture" id="AtlasTexture_u5r5b"]
+atlas = ExtResource("2_8tl8f")
+region = Rect2(384, 528, 32, 16)
+
+[sub_resource type="AtlasTexture" id="AtlasTexture_5h70f"]
+atlas = ExtResource("2_8tl8f")
+region = Rect2(384, 528, 48, 16)
+
+[sub_resource type="AtlasTexture" id="AtlasTexture_osbyn"]
+atlas = ExtResource("2_8tl8f")
+region = Rect2(384, 528, 64, 16)
+
+[sub_resource type="SpriteFrames" id="SpriteFrames_xn7q5"]
+animations = [{
+"frames": [{
+"duration": 1.0,
+"texture": SubResource("AtlasTexture_skslo")
+}, {
+"duration": 1.0,
+"texture": SubResource("AtlasTexture_u5r5b")
+}, {
+"duration": 1.0,
+"texture": SubResource("AtlasTexture_5h70f")
+}, {
+"duration": 1.0,
+"texture": SubResource("AtlasTexture_osbyn")
+}],
+"loop": false,
+"name": &"default",
+"speed": 8.0
+}]
+
+[node name="Vines" type="StaticBody2D"]
+z_index = -1
+collision_layer = 72
+collision_mask = 0
+script = ExtResource("1_ymtv0")
+
+[node name="CollisionShape2D" type="CollisionShape2D" parent="."]
+shape = SubResource("RectangleShape2D_5f74o")
+
+[node name="AnimatedSprite2D" type="AnimatedSprite2D" parent="."]
+position = Vector2(-8, -8)
+sprite_frames = SubResource("SpriteFrames_xn7q5")
+centered = false