Spawn player from world index

This commit is contained in:
anonoe 2026-02-10 14:13:56 +01:00
parent 77114f5551
commit 141d0240c2
Signed by: anonoe
SSH key fingerprint: SHA256:OnAs6gNQelOnDiY5tBpDYKQiuTgBvnmIdMo5P09cdqg
2 changed files with 16 additions and 17 deletions

View file

@ -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)