Spawn player from world index
This commit is contained in:
parent
77114f5551
commit
141d0240c2
2 changed files with 16 additions and 17 deletions
|
|
@ -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)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue