From 9352e4c0fd4726746f8dfd56f056e44de3c099f4 Mon Sep 17 00:00:00 2001 From: Zenny Date: Tue, 11 Feb 2025 02:53:45 -0800 Subject: [PATCH] Fix initial spawn, center thrown item a bit more --- src/game/Game.cs | 2 +- src/items/thrown/ThrownItem.tscn | 1 - src/map/dungeon/code/Floor0.cs | 8 ++++++++ src/map/dungeon/floors/Floor00.tscn | 8 ++++---- 4 files changed, 13 insertions(+), 6 deletions(-) diff --git a/src/game/Game.cs b/src/game/Game.cs index 564caf97..9319e755 100644 --- a/src/game/Game.cs +++ b/src/game/Game.cs @@ -162,7 +162,7 @@ public partial class Game : Node3D, IGame var thrown = thrownScene.Instantiate(); thrown.ItemThatIsThrown = item; AddChild(thrown); - thrown.Position += new Vector3(0, 1.5f, -0.5f); + thrown.Position += new Vector3(-0.5f, 1.5f, -0.5f); thrown.Throw(); } diff --git a/src/items/thrown/ThrownItem.tscn b/src/items/thrown/ThrownItem.tscn index a1e9c632..f9d368af 100644 --- a/src/items/thrown/ThrownItem.tscn +++ b/src/items/thrown/ThrownItem.tscn @@ -7,7 +7,6 @@ size = Vector3(0.46632, 0.507293, 0.586082) [node name="Hitbox" type="RigidBody3D"] -transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 2, 0) collision_layer = 16 collision_mask = 25 gravity_scale = 0.25 diff --git a/src/map/dungeon/code/Floor0.cs b/src/map/dungeon/code/Floor0.cs index 0645efbf..75507aae 100644 --- a/src/map/dungeon/code/Floor0.cs +++ b/src/map/dungeon/code/Floor0.cs @@ -10,8 +10,15 @@ public partial class Floor0 : Node3D, IDungeonFloor [Node] public Marker3D PlayerSpawnPoint { get; set; } = default!; + [Dependency] protected IPlayer Player => this.DependOn(); + [Node] public Marker3D ExitSpawnPoint { get; set; } = default!; + public void Setup() + { + Player.TeleportPlayer(new Vector3(PlayerSpawnPoint.Position.X, -1.75f, PlayerSpawnPoint.Position.Z)); + } + public Transform3D GetPlayerSpawnPoint() { return PlayerSpawnPoint.GlobalTransform; @@ -24,5 +31,6 @@ public partial class Floor0 : Node3D, IDungeonFloor public void InitializeDungeon() { + Show(); } } diff --git a/src/map/dungeon/floors/Floor00.tscn b/src/map/dungeon/floors/Floor00.tscn index 6210a732..a2e95c3b 100644 --- a/src/map/dungeon/floors/Floor00.tscn +++ b/src/map/dungeon/floors/Floor00.tscn @@ -1,6 +1,6 @@ [gd_scene load_steps=60 format=4 uid="uid://dl6h1djc27ddl"] -[ext_resource type="Script" uid="uid://cuhfkyh3d7noa" path="res://src/map/dungeon/code/Overworld.cs" id="1_vwmxx"] +[ext_resource type="Script" uid="uid://c1nhqlem1ew3m" path="res://src/map/dungeon/code/Floor0.cs" id="1_db2o3"] [ext_resource type="Texture2D" uid="uid://b27ksiyfefb33" path="res://src/map/dungeon/models/altar/02_ALTAR_FLOOR_ZER0_VER_outside_desert.png" id="2_xh2ej"] [ext_resource type="Texture2D" uid="uid://cmfhbi07s4v5x" path="res://src/map/dungeon/models/altar/02_ALTAR_FLOOR_ZER0_VER_BOULDER_DARK.png" id="3_aqomv"] [ext_resource type="Texture2D" uid="uid://cfo5c1twdrnea" path="res://src/map/dungeon/models/altar/02_ALTAR_FLOOR_ZER0_VER_concrete_0025_color_1k.jpg" id="4_db2o3"] @@ -726,11 +726,11 @@ size = Vector3(1.53375, 1.46143, 3.13956) [node name="Floor0" type="Node3D"] transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0.63488, -5.13176) -script = ExtResource("1_vwmxx") +script = ExtResource("1_db2o3") [node name="PlayerSpawnPoint" type="Marker3D" parent="."] unique_name_in_owner = true -transform = Transform3D(0.0152187, 0, 0.999884, 0, 1, 0, -0.999884, 0, 0.0152187, 3.6247, -2.61166, -1.03518) +transform = Transform3D(0.0152187, 0, 0.999884, 0, 1, 0, -0.999884, 0, 0.0152187, 3.6247, -3.07997, -1.03518) [node name="ExitSpawnPoint" type="Marker3D" parent="."] unique_name_in_owner = true @@ -841,5 +841,5 @@ transform = Transform3D(0.857993, 0, 0.513661, 0, 1, 0, -0.513661, 0, 0.857993, shape = SubResource("BoxShape3D_xh2ej") [node name="ThrowableItem" parent="." instance=ExtResource("16_db2o3")] -transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -3.46917, -1.74655, 0) +transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -3.469, -2.5, 0) _throwableItemStats = ExtResource("17_ntxe5")