summaryrefslogtreecommitdiff
path: root/map/objects
diff options
context:
space:
mode:
authorDaniel Weipert <git@mail.dweipert.de>2025-03-10 18:22:09 +0100
committerDaniel Weipert <git@mail.dweipert.de>2025-03-10 18:22:09 +0100
commit440020e642f539079867577435a9f8b02075699b (patch)
tree99acccfc1574a8ffc656d6f64ff934949edb1f52 /map/objects
initial commitHEADmain
Diffstat (limited to 'map/objects')
-rw-r--r--map/objects/door.gd15
-rw-r--r--map/objects/door.gd.uid1
-rw-r--r--map/objects/door.tscn25
-rw-r--r--map/objects/ledge.gd46
-rw-r--r--map/objects/ledge.gd.uid1
-rw-r--r--map/objects/ledge.tscn47
-rw-r--r--map/objects/out_door.tscn21
-rw-r--r--map/objects/stairs.gd11
-rw-r--r--map/objects/stairs.gd.uid1
-rw-r--r--map/objects/stairs.tscn23
10 files changed, 191 insertions, 0 deletions
diff --git a/map/objects/door.gd b/map/objects/door.gd
new file mode 100644
index 0000000..20b0c65
--- /dev/null
+++ b/map/objects/door.gd
@@ -0,0 +1,15 @@
+class_name Door
+extends Node2D
+
+
+@export_file("*.tscn") var scene: String
+@export var map_entry: String
+
+
+func _on_body_entered(body: Node2D) -> void:
+ if body is Player:
+ Game.current_map_entry = map_entry
+ Sound.door.play()
+ await Game.fade_out()
+ Game.world.set_map(scene)
+ Game.fade_in()
diff --git a/map/objects/door.gd.uid b/map/objects/door.gd.uid
new file mode 100644
index 0000000..2ed2826
--- /dev/null
+++ b/map/objects/door.gd.uid
@@ -0,0 +1 @@
+uid://0xkcx8qk47gx
diff --git a/map/objects/door.tscn b/map/objects/door.tscn
new file mode 100644
index 0000000..dba01a0
--- /dev/null
+++ b/map/objects/door.tscn
@@ -0,0 +1,25 @@
+[gd_scene load_steps=5 format=3 uid="uid://bw2qihhy14bxr"]
+
+[ext_resource type="Script" uid="uid://0xkcx8qk47gx" path="res://map/objects/door.gd" id="1_84465"]
+[ext_resource type="Texture2D" uid="uid://dv8lud5b0tu3h" path="res://map/assets/tileset.png" id="1_i1plv"]
+
+[sub_resource type="AtlasTexture" id="AtlasTexture_84465"]
+atlas = ExtResource("1_i1plv")
+region = Rect2(16, 64, 16, 16)
+
+[sub_resource type="RectangleShape2D" id="RectangleShape2D_84465"]
+size = Vector2(10, 8)
+
+[node name="Door" type="Area2D"]
+script = ExtResource("1_84465")
+
+[node name="Sprite2D" type="Sprite2D" parent="."]
+texture = SubResource("AtlasTexture_84465")
+centered = false
+offset = Vector2(-8, -8)
+
+[node name="CollisionShape2D" type="CollisionShape2D" parent="."]
+position = Vector2(0, -1)
+shape = SubResource("RectangleShape2D_84465")
+
+[connection signal="body_entered" from="." to="." method="_on_body_entered"]
diff --git a/map/objects/ledge.gd b/map/objects/ledge.gd
new file mode 100644
index 0000000..755cd85
--- /dev/null
+++ b/map/objects/ledge.gd
@@ -0,0 +1,46 @@
+extends Area2D
+
+
+var is_jumping := false
+
+
+func _on_body_entered(body: Node2D) -> void:
+ if body is Player and not is_jumping:
+ print("??", is_jumping)
+ is_jumping = true
+
+ var grid_position := World.local_to_map(global_position)
+ var target_position := World.map_to_local(grid_position + Vector2i(0, 1))
+
+ var shadow = body.get_node("Shadow")
+ var shadow_offset = Vector2(-4,5)#shadow.position
+
+ var tween1 := create_tween().set_ease(Tween.EASE_IN_OUT).set_parallel()
+ tween1.tween_property(body, "position", body.position + Vector2(0, -3), 0.25)
+ tween1.tween_property(shadow, "position", shadow.position + Vector2(0, 3), 0.25)
+ await tween1.finished
+
+ var tween = create_tween().set_ease(Tween.EASE_IN_OUT).set_trans(Tween.TRANS_QUAD).set_parallel()
+
+ tween.tween_property(
+ body,
+ "global_position",
+ target_position,
+ 1.0
+ )
+ tween.tween_property(
+ get_viewport().get_camera_2d(),
+ "global_position",
+ target_position,
+ 1.0
+ )
+
+ tween.tween_property(
+ shadow,
+ "global_position",
+ target_position + shadow_offset,
+ 1.0
+ )
+
+ await tween.finished
+ is_jumping = false
diff --git a/map/objects/ledge.gd.uid b/map/objects/ledge.gd.uid
new file mode 100644
index 0000000..9effc6b
--- /dev/null
+++ b/map/objects/ledge.gd.uid
@@ -0,0 +1 @@
+uid://xnlyw4tf65bk
diff --git a/map/objects/ledge.tscn b/map/objects/ledge.tscn
new file mode 100644
index 0000000..8183fde
--- /dev/null
+++ b/map/objects/ledge.tscn
@@ -0,0 +1,47 @@
+[gd_scene load_steps=7 format=3 uid="uid://bk7ff5g2pk0cp"]
+
+[ext_resource type="Script" uid="uid://xnlyw4tf65bk" path="res://map/objects/ledge.gd" id="1_nwiaq"]
+[ext_resource type="Texture2D" uid="uid://dv8lud5b0tu3h" path="res://map/assets/tileset.png" id="1_wrxto"]
+
+[sub_resource type="AtlasTexture" id="AtlasTexture_nwiaq"]
+atlas = ExtResource("1_wrxto")
+region = Rect2(0, 16, 16, 16)
+
+[sub_resource type="RectangleShape2D" id="RectangleShape2D_jlg2s"]
+size = Vector2(16, 1.75)
+
+[sub_resource type="RectangleShape2D" id="RectangleShape2D_nc3l7"]
+size = Vector2(16, 0.5)
+
+[sub_resource type="RectangleShape2D" id="RectangleShape2D_nwiaq"]
+size = Vector2(1.125, 8)
+
+[node name="Ledge" type="Area2D"]
+collision_layer = 0
+script = ExtResource("1_nwiaq")
+
+[node name="Sprite2D" type="Sprite2D" parent="."]
+position = Vector2(0, -2)
+texture = SubResource("AtlasTexture_nwiaq")
+
+[node name="CollisionShape2D" type="CollisionShape2D" parent="."]
+position = Vector2(0, 0.875)
+shape = SubResource("RectangleShape2D_jlg2s")
+
+[node name="StaticBody2D" type="StaticBody2D" parent="."]
+collision_layer = 2
+collision_mask = 0
+
+[node name="CollisionShape2D" type="CollisionShape2D" parent="StaticBody2D"]
+position = Vector2(0, 7.75)
+shape = SubResource("RectangleShape2D_nc3l7")
+
+[node name="CollisionShape2D2" type="CollisionShape2D" parent="StaticBody2D"]
+position = Vector2(-8, 4)
+shape = SubResource("RectangleShape2D_nwiaq")
+
+[node name="CollisionShape2D3" type="CollisionShape2D" parent="StaticBody2D"]
+position = Vector2(8, 4)
+shape = SubResource("RectangleShape2D_nwiaq")
+
+[connection signal="body_entered" from="." to="." method="_on_body_entered"]
diff --git a/map/objects/out_door.tscn b/map/objects/out_door.tscn
new file mode 100644
index 0000000..e74a75b
--- /dev/null
+++ b/map/objects/out_door.tscn
@@ -0,0 +1,21 @@
+[gd_scene load_steps=5 format=3 uid="uid://dw86phlo8int2"]
+
+[ext_resource type="PackedScene" uid="uid://bw2qihhy14bxr" path="res://map/objects/door.tscn" id="1_ssknr"]
+[ext_resource type="Texture2D" uid="uid://dv8lud5b0tu3h" path="res://map/assets/tileset.png" id="2_1ia0c"]
+
+[sub_resource type="AtlasTexture" id="AtlasTexture_yms24"]
+atlas = ExtResource("2_1ia0c")
+region = Rect2(16, 64, 16, 16)
+
+[sub_resource type="RectangleShape2D" id="RectangleShape2D_ssknr"]
+size = Vector2(4, 4)
+
+[node name="DoorOut" instance=ExtResource("1_ssknr")]
+
+[node name="Sprite2D" parent="." index="0"]
+visible = false
+texture = SubResource("AtlasTexture_yms24")
+
+[node name="CollisionShape2D" parent="." index="1"]
+position = Vector2(0, 0)
+shape = SubResource("RectangleShape2D_ssknr")
diff --git a/map/objects/stairs.gd b/map/objects/stairs.gd
new file mode 100644
index 0000000..3ebaf80
--- /dev/null
+++ b/map/objects/stairs.gd
@@ -0,0 +1,11 @@
+extends Door
+
+
+@export var invert_direction := true
+
+
+func _on_body_entered(body: Node2D) -> void:
+ if body is Player:
+ await super._on_body_entered(body)
+ if invert_direction:
+ Game.current_direction *= -1
diff --git a/map/objects/stairs.gd.uid b/map/objects/stairs.gd.uid
new file mode 100644
index 0000000..273ebc0
--- /dev/null
+++ b/map/objects/stairs.gd.uid
@@ -0,0 +1 @@
+uid://cthaxa2q26ia2
diff --git a/map/objects/stairs.tscn b/map/objects/stairs.tscn
new file mode 100644
index 0000000..ba1530e
--- /dev/null
+++ b/map/objects/stairs.tscn
@@ -0,0 +1,23 @@
+[gd_scene load_steps=6 format=3 uid="uid://c3cuwuulkgpld"]
+
+[ext_resource type="PackedScene" uid="uid://bw2qihhy14bxr" path="res://map/objects/door.tscn" id="1_eo2eb"]
+[ext_resource type="Script" uid="uid://cthaxa2q26ia2" path="res://map/objects/stairs.gd" id="2_a67cu"]
+[ext_resource type="Texture2D" uid="uid://dv8lud5b0tu3h" path="res://map/assets/tileset.png" id="2_nnfkg"]
+
+[sub_resource type="AtlasTexture" id="AtlasTexture_a67cu"]
+atlas = ExtResource("2_nnfkg")
+region = Rect2(144, 32, 16, 16)
+
+[sub_resource type="RectangleShape2D" id="RectangleShape2D_eo2eb"]
+size = Vector2(10, 14)
+
+[node name="Stairs" instance=ExtResource("1_eo2eb")]
+script = ExtResource("2_a67cu")
+invert_direction = true
+
+[node name="Sprite2D" parent="." index="0"]
+texture = SubResource("AtlasTexture_a67cu")
+
+[node name="CollisionShape2D" parent="." index="1"]
+position = Vector2(-2, 0)
+shape = SubResource("RectangleShape2D_eo2eb")