From b89921dcd690068b8c267ae2907d8037a587c0e8 Mon Sep 17 00:00:00 2001 From: Kristofers Solo Date: Thu, 12 Dec 2024 19:33:35 +0200 Subject: [PATCH] fix(player): spawn position --- src/player/systems/spawn.rs | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/player/systems/spawn.rs b/src/player/systems/spawn.rs index aacb49e..08a35f5 100644 --- a/src/player/systems/spawn.rs +++ b/src/player/systems/spawn.rs @@ -17,12 +17,15 @@ pub fn spawn_player( let player_height = maze_config.height * 0.5; let player_radius = maze_config.hex_size * 0.5; + let start_hex = Hex::new(1, 1); + let start_pos = maze_config.layout.hex_to_world_pos(start_hex); + commands.spawn(( Name::new("Player"), Player, - CurrentPosition(Hex::new(1, 1)), + CurrentPosition(start_hex), Mesh3d(meshes.add(generate_pill_mesh(player_radius, player_height / 2.))), MeshMaterial3d(materials.add(blue_material())), - Transform::from_xyz(0., player_height * 2., 0.), + Transform::from_xyz(start_pos.x, player_height * 2., start_pos.y), )); }