summaryrefslogtreecommitdiff
path: root/Scenes/Entities/Objects
diff options
context:
space:
mode:
authorDaniel Weipert <git@mail.dweipert.de>2024-04-27 20:06:49 +0200
committerDaniel Weipert <git@mail.dweipert.de>2024-04-27 20:06:49 +0200
commit81cc6f1d22677dd4a60aa9377c91b291bf10e523 (patch)
tree9c22712a9746ed0598a44be6e88727d021436860 /Scenes/Entities/Objects
parentc8a316e4b8987dad963656a34665fa0e23dedcb1 (diff)
update
Diffstat (limited to 'Scenes/Entities/Objects')
-rw-r--r--Scenes/Entities/Objects/Box.gd2
-rw-r--r--Scenes/Entities/Objects/Box.tscn2
-rw-r--r--Scenes/Entities/Objects/Coin.tscn1
-rw-r--r--Scenes/Entities/Objects/Grass.tscn108
-rw-r--r--Scenes/Entities/Objects/MountainWall.gd16
-rw-r--r--Scenes/Entities/Objects/MountainWall.tscn22
-rw-r--r--Scenes/Entities/Objects/Sign.gd2
-rw-r--r--Scenes/Entities/Objects/Tree.gd48
-rw-r--r--Scenes/Entities/Objects/Tree.tscn62
-rw-r--r--Scenes/Entities/Objects/Vines.gd11
-rw-r--r--Scenes/Entities/Objects/Vines.tscn5
11 files changed, 273 insertions, 6 deletions
diff --git a/Scenes/Entities/Objects/Box.gd b/Scenes/Entities/Objects/Box.gd
index c7b7d4e..8d1d40b 100644
--- a/Scenes/Entities/Objects/Box.gd
+++ b/Scenes/Entities/Objects/Box.gd
@@ -2,6 +2,8 @@ extends StaticBody2D
func _ready():
+ add_to_group("breakables")
+
var collision_area = Utilities.Collision.Area.new(self, $CollisionShape2D, false)
collision_area.connect("collided", Callable(self, "_collide"))
add_child(collision_area)
diff --git a/Scenes/Entities/Objects/Box.tscn b/Scenes/Entities/Objects/Box.tscn
index c549618..2e02d75 100644
--- a/Scenes/Entities/Objects/Box.tscn
+++ b/Scenes/Entities/Objects/Box.tscn
@@ -87,7 +87,7 @@ _data = {
"breaking": SubResource("Animation_ihbs5")
}
-[node name="Box" type="StaticBody2D" groups=["breakables"]]
+[node name="Box" type="StaticBody2D"]
collision_layer = 8
collision_mask = 32
script = ExtResource("1_owgyi")
diff --git a/Scenes/Entities/Objects/Coin.tscn b/Scenes/Entities/Objects/Coin.tscn
index 1025602..887ef0c 100644
--- a/Scenes/Entities/Objects/Coin.tscn
+++ b/Scenes/Entities/Objects/Coin.tscn
@@ -16,6 +16,7 @@ script = ExtResource("1_kjrye")
shape = SubResource("RectangleShape2D_rwppg")
[node name="Sprite2D" type="Sprite2D" parent="."]
+texture_filter = 1
scale = Vector2(1.1, 1.1)
texture = ExtResource("2_jf7cy")
region_enabled = true
diff --git a/Scenes/Entities/Objects/Grass.tscn b/Scenes/Entities/Objects/Grass.tscn
new file mode 100644
index 0000000..32667e9
--- /dev/null
+++ b/Scenes/Entities/Objects/Grass.tscn
@@ -0,0 +1,108 @@
+[gd_scene load_steps=7 format=3 uid="uid://12suyw87jcsi"]
+
+[ext_resource type="Script" path="res://Scenes/Entities/Objects/Box.gd" id="1_m0mhm"]
+[ext_resource type="Texture2D" uid="uid://bxl3lqlm22eem" path="res://Assets/Stages/core_outdoor.png" id="1_yfcbg"]
+
+[sub_resource type="RectangleShape2D" id="RectangleShape2D_5fege"]
+size = Vector2(14, 14)
+
+[sub_resource type="Animation" id="Animation_5u23n"]
+length = 0.001
+tracks/0/type = "bezier"
+tracks/0/imported = false
+tracks/0/enabled = true
+tracks/0/path = NodePath("Sprite2D:modulate:r")
+tracks/0/interp = 1
+tracks/0/loop_wrap = true
+tracks/0/keys = {
+"handle_modes": PackedInt32Array(0),
+"points": PackedFloat32Array(1, -0.25, 0, 0.25, 0),
+"times": PackedFloat32Array(0)
+}
+tracks/1/type = "bezier"
+tracks/1/imported = false
+tracks/1/enabled = true
+tracks/1/path = NodePath("Sprite2D:modulate:g")
+tracks/1/interp = 1
+tracks/1/loop_wrap = true
+tracks/1/keys = {
+"handle_modes": PackedInt32Array(0),
+"points": PackedFloat32Array(1, -0.25, 0, 0.25, 0),
+"times": PackedFloat32Array(0)
+}
+tracks/2/type = "bezier"
+tracks/2/imported = false
+tracks/2/enabled = true
+tracks/2/path = NodePath("Sprite2D:modulate:b")
+tracks/2/interp = 1
+tracks/2/loop_wrap = true
+tracks/2/keys = {
+"handle_modes": PackedInt32Array(0),
+"points": PackedFloat32Array(1, -0.25, 0, 0.25, 0),
+"times": PackedFloat32Array(0)
+}
+tracks/3/type = "bezier"
+tracks/3/imported = false
+tracks/3/enabled = true
+tracks/3/path = NodePath("Sprite2D:modulate:a")
+tracks/3/interp = 1
+tracks/3/loop_wrap = true
+tracks/3/keys = {
+"handle_modes": PackedInt32Array(0),
+"points": PackedFloat32Array(1, -0.25, 0, 0.25, 0),
+"times": PackedFloat32Array(0)
+}
+tracks/4/type = "value"
+tracks/4/imported = false
+tracks/4/enabled = true
+tracks/4/path = NodePath("Sprite2D:modulate")
+tracks/4/interp = 1
+tracks/4/loop_wrap = true
+tracks/4/keys = {
+"times": PackedFloat32Array(0),
+"transitions": PackedFloat32Array(1),
+"update": 0,
+"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"),
+"breaking": SubResource("Animation_ihbs5")
+}
+
+[node name="Grass" type="StaticBody2D"]
+collision_layer = 8
+collision_mask = 32
+script = ExtResource("1_m0mhm")
+
+[node name="CollisionShape2D" type="CollisionShape2D" parent="."]
+shape = SubResource("RectangleShape2D_5fege")
+
+[node name="Sprite2D" type="Sprite2D" parent="."]
+modulate = Color(1, 1, 0, 1)
+texture_filter = 1
+texture = ExtResource("1_yfcbg")
+region_enabled = true
+region_rect = Rect2(400, 528, 16, 16)
+
+[node name="AnimationPlayer" type="AnimationPlayer" parent="."]
+libraries = {
+"": SubResource("AnimationLibrary_cqvgo")
+}
diff --git a/Scenes/Entities/Objects/MountainWall.gd b/Scenes/Entities/Objects/MountainWall.gd
new file mode 100644
index 0000000..f740ce2
--- /dev/null
+++ b/Scenes/Entities/Objects/MountainWall.gd
@@ -0,0 +1,16 @@
+extends StaticBody2D
+
+
+func _ready():
+ add_to_group("breakables")
+
+ var collision_area = Utilities.Collision.Area.new(self, $CollisionShape2D, false)
+ collision_area.connect("collided", Callable(self, "_collide"))
+ add_child(collision_area)
+
+
+func hit_by_explosion():
+ #$AnimationPlayer.play("breaking")
+ #await $AnimationPlayer.animation_finished
+
+ queue_free()
diff --git a/Scenes/Entities/Objects/MountainWall.tscn b/Scenes/Entities/Objects/MountainWall.tscn
new file mode 100644
index 0000000..1225eeb
--- /dev/null
+++ b/Scenes/Entities/Objects/MountainWall.tscn
@@ -0,0 +1,22 @@
+[gd_scene load_steps=4 format=3 uid="uid://dhew0ddumipfy"]
+
+[ext_resource type="Script" path="res://Scenes/Entities/Objects/MountainWall.gd" id="1_6mkhl"]
+[ext_resource type="Texture2D" uid="uid://cctukh2hhfgty" path="res://Assets/Stages/core_outdoor_nature.png" id="2_dioff"]
+
+[sub_resource type="RectangleShape2D" id="RectangleShape2D_f5uqi"]
+size = Vector2(14, 12)
+
+[node name="MountainWall" type="StaticBody2D"]
+texture_filter = 1
+collision_layer = 8
+collision_mask = 32
+script = ExtResource("1_6mkhl")
+
+[node name="CollisionShape2D" type="CollisionShape2D" parent="."]
+position = Vector2(0, -1)
+shape = SubResource("RectangleShape2D_f5uqi")
+
+[node name="Sprite2D" type="Sprite2D" parent="."]
+texture = ExtResource("2_dioff")
+region_enabled = true
+region_rect = Rect2(656, 0, 16, 16)
diff --git a/Scenes/Entities/Objects/Sign.gd b/Scenes/Entities/Objects/Sign.gd
index 81d3a6c..9b2e4b1 100644
--- a/Scenes/Entities/Objects/Sign.gd
+++ b/Scenes/Entities/Objects/Sign.gd
@@ -14,7 +14,7 @@ func _ready():
func _input(event):
- if Input.is_action_just_pressed("ui_accept") and interaction_area.has_overlapping_areas():
+ if event.is_action_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/Tree.gd b/Scenes/Entities/Objects/Tree.gd
new file mode 100644
index 0000000..3d8d669
--- /dev/null
+++ b/Scenes/Entities/Objects/Tree.gd
@@ -0,0 +1,48 @@
+extends StaticBody2D
+
+
+@export_enum("up", "down", "left", "right") var fall_direction: String
+@onready var map: TileMap = get_parent().get_parent().get_node("TileMap")
+
+
+func _ready():
+ add_to_group("breakables")
+
+ var collision_area = Utilities.Collision.Area.new(self, $CollisionShape2D, false)
+ collision_area.connect("collided", Callable(self, "_collide"))
+ add_child(collision_area)
+
+
+func hit_by_explosion():
+ var direction = Vector2(0, 0)
+
+ if fall_direction == "up":
+ position.y -= 5
+ direction = Vector2(0, -1)
+ elif fall_direction == "down":
+ rotate(deg_to_rad(180))
+ position.y += 5
+ direction = Vector2(0, 1)
+ elif fall_direction == "left":
+ rotate(deg_to_rad(-90))
+ position.x -= 5
+ direction = Vector2(-1, 0)
+ elif fall_direction == "right":
+ rotate(deg_to_rad(90))
+ position.x += 5
+ direction = Vector2(1, 0)
+
+ for r in range(3):
+ var vec = map.local_to_map(self.position + direction*16*r)
+ map.set_cell(
+ 0,
+ vec,
+ 6,
+ map.get_cell_atlas_coords(0, vec),
+ map.get_cell_alternative_tile(0, vec)
+ )
+
+ $Edges.process_mode = Node.PROCESS_MODE_INHERIT
+ $CollisionShape2D.disabled = true
+ $SpriteStanding.visible = false
+ $SpriteFallen.visible = true
diff --git a/Scenes/Entities/Objects/Tree.tscn b/Scenes/Entities/Objects/Tree.tscn
new file mode 100644
index 0000000..fdffec1
--- /dev/null
+++ b/Scenes/Entities/Objects/Tree.tscn
@@ -0,0 +1,62 @@
+[gd_scene load_steps=6 format=3 uid="uid://c2mescm8l71w6"]
+
+[ext_resource type="Script" path="res://Scenes/Entities/Objects/Tree.gd" id="1_8ww5x"]
+[ext_resource type="Texture2D" uid="uid://bxl3lqlm22eem" path="res://Assets/Stages/core_outdoor.png" id="1_td4yb"]
+
+[sub_resource type="RectangleShape2D" id="RectangleShape2D_iw7db"]
+size = Vector2(12, 17)
+
+[sub_resource type="SegmentShape2D" id="SegmentShape2D_kp5bv"]
+a = Vector2(0, -18)
+b = Vector2(0, 1)
+
+[sub_resource type="SegmentShape2D" id="SegmentShape2D_yfa0c"]
+a = Vector2(0, -18)
+b = Vector2(0, 1)
+
+[node name="Tree" type="StaticBody2D"]
+texture_filter = 1
+collision_layer = 8
+collision_mask = 32
+script = ExtResource("1_8ww5x")
+
+[node name="SpriteStanding" type="Node2D" parent="."]
+
+[node name="Sprite2D" type="Sprite2D" parent="SpriteStanding"]
+z_index = -1
+texture = ExtResource("1_td4yb")
+region_enabled = true
+region_rect = Rect2(384, 464, 16, 16)
+
+[node name="Sprite2D2" type="Sprite2D" parent="SpriteStanding"]
+position = Vector2(0, -16)
+texture = ExtResource("1_td4yb")
+region_enabled = true
+region_rect = Rect2(384, 448, 16, 16)
+
+[node name="SpriteFallen" type="Node2D" parent="."]
+visible = false
+
+[node name="Sprite2D" type="Sprite2D" parent="SpriteFallen"]
+z_index = -1
+position = Vector2(0, -8)
+texture = ExtResource("1_td4yb")
+region_enabled = true
+region_rect = Rect2(384, 448, 16, 32)
+
+[node name="CollisionShape2D" type="CollisionShape2D" parent="."]
+position = Vector2(0, -1.5)
+shape = SubResource("RectangleShape2D_iw7db")
+
+[node name="Edges" type="StaticBody2D" parent="."]
+process_mode = 4
+collision_layer = 8
+collision_mask = 0
+
+[node name="CollisionShape2D" type="CollisionShape2D" parent="Edges"]
+position = Vector2(10, -3)
+shape = SubResource("SegmentShape2D_kp5bv")
+
+[node name="CollisionShape2D2" type="CollisionShape2D" parent="Edges"]
+position = Vector2(-10, -3)
+shape = SubResource("SegmentShape2D_yfa0c")
diff --git a/Scenes/Entities/Objects/Vines.gd b/Scenes/Entities/Objects/Vines.gd
index ac2c249..5e36fc2 100644
--- a/Scenes/Entities/Objects/Vines.gd
+++ b/Scenes/Entities/Objects/Vines.gd
@@ -27,7 +27,8 @@ func _process(_delta):
func spread():
var grow = func():
- $CollisionShape2D.shape.size.x += 16 * $AnimatedSprite2D.frame
+ $CollisionShape2D.shape.size.x += 8 * $AnimatedSprite2D.frame
+ $CollisionShape2D.position.x += 8
$AnimatedSprite2D.frame_changed.connect(grow)
$AnimatedSprite2D.play()
@@ -37,17 +38,19 @@ func spread():
func retract():
var shrink = func():
- $CollisionShape2D.shape.size.x -= 16 * ($AnimatedSprite2D.frame + 1)
+ $CollisionShape2D.shape.size.x -= 8 * ($AnimatedSprite2D.frame + 1)
+ $CollisionShape2D.position.x -= 8
$AnimatedSprite2D.frame_changed.connect(shrink)
$AnimatedSprite2D.play_backwards()
await $AnimatedSprite2D.animation_finished
$AnimatedSprite2D.frame_changed.disconnect(shrink)
- await get_tree().create_timer(3).timeout
+ $Timer.start()
+ await $Timer.timeout
spread()
func hit_by_explosion():
- if not $AnimatedSprite2D.is_playing():
+ if not $AnimatedSprite2D.is_playing() and $Timer.is_stopped():
retract()
diff --git a/Scenes/Entities/Objects/Vines.tscn b/Scenes/Entities/Objects/Vines.tscn
index 2fd10f8..1fecc49 100644
--- a/Scenes/Entities/Objects/Vines.tscn
+++ b/Scenes/Entities/Objects/Vines.tscn
@@ -53,6 +53,11 @@ script = ExtResource("1_ymtv0")
shape = SubResource("RectangleShape2D_5f74o")
[node name="AnimatedSprite2D" type="AnimatedSprite2D" parent="."]
+texture_filter = 1
position = Vector2(-8, -8)
sprite_frames = SubResource("SpriteFrames_xn7q5")
centered = false
+
+[node name="Timer" type="Timer" parent="."]
+wait_time = 5.0
+one_shot = true