diff --git a/scenes/Player.tscn b/scenes/Player.tscn index e700709..a140624 100644 --- a/scenes/Player.tscn +++ b/scenes/Player.tscn @@ -2,27 +2,20 @@ [ext_resource type="Script" uid="uid://duf0vlr2yin8l" path="res://scripts/gameplay/Player.cs" id="1_p0vlq"] -[sub_resource type="CircleShape2D" id="CircleShape2D_v6fml"] - -[sub_resource type="Gradient" id="Gradient_p0vlq"] - -[sub_resource type="GradientTexture2D" id="GradientTexture2D_v6fml"] -gradient = SubResource("Gradient_p0vlq") -width = 16 -height = 16 +[sub_resource type="CapsuleShape2D" id="CapsuleShape2D_p0vlq"] [node name="Player" type="CharacterBody2D" unique_id=1675096620] script = ExtResource("1_p0vlq") +[node name="Sprite2D" type="Sprite2D" parent="." unique_id=1954630810] + [node name="CollisionShape2D" type="CollisionShape2D" parent="." unique_id=1337429488] -position = Vector2(-15, -16) -shape = SubResource("CircleShape2D_v6fml") +rotation = 1.5707964 +shape = SubResource("CapsuleShape2D_p0vlq") -[node name="Sprite2D" type="Sprite2D" parent="CollisionShape2D" unique_id=554119030] -position = Vector2(15, 16) -texture = SubResource("GradientTexture2D_v6fml") +[node name="Camera2D" type="Camera2D" parent="." unique_id=483897590] -[node name="ColorRect" type="ColorRect" parent="CollisionShape2D" unique_id=1178008943] +[node name="ColorRect" type="ColorRect" parent="." unique_id=2037024702] anchors_preset = 8 anchor_left = 0.5 anchor_top = 0.5 @@ -34,5 +27,3 @@ offset_right = 8.0 offset_bottom = 8.0 grow_horizontal = 2 grow_vertical = 2 - -[node name="Camera2D" type="Camera2D" parent="." unique_id=483897590] diff --git a/scripts/world/ChunkManager.cs b/scripts/world/ChunkManager.cs index eec9bbd..3d9cece 100644 --- a/scripts/world/ChunkManager.cs +++ b/scripts/world/ChunkManager.cs @@ -51,9 +51,17 @@ public partial class ChunkManager : Node2D GD.PrintErr("ChunkManager: Failed to parse world index."); return; } - _chunkMap = _world.BuildChunkMap(); GD.Print($"World loaded: {_world.world_id}, chunks: {_chunkMap.Count}, chunk_size_px={_world.chunk_size_px}"); + + // After loading world index, set player spawn position + if (_player != null && _world.start_pos_px.Length == 2) + { + _player.GlobalPosition = new Vector2( + _world.start_pos_px[0], + _world.start_pos_px[1] + ); + } } public override void _Process(double delta)