From 562b965c8b5847e89a9b9381a4b5ba209eee0861 Mon Sep 17 00:00:00 2001 From: _Corentin_ Date: Fri, 26 May 2023 08:37:21 +0200 Subject: [PATCH] nom de variable + doc --- src/map.rs | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/map.rs b/src/map.rs index 8c1fe32..07b2a4c 100644 --- a/src/map.rs +++ b/src/map.rs @@ -75,18 +75,18 @@ pub enum Tile { Wall, } -/// Permet de crée des entité representant les cases d'une map, sur une longueur et langueur donné. -pub fn init_map(longueur: u8, largeur: u8, mut commands: Commands) { - for x in 0..longueur { - for y in 0..largeur { - if !(x % 2 == 0 && y == longueur - 1) { +/// Initialisation d'une map aleatoire. +pub fn init_map(width: u8, height: u8, mut commands: Commands) { + for x in 0..width { + for y in 0..height { + if !(x % 2 == 0 && y == width - 1) { commands.spawn((generate_random_tile_for_map(), Position { x, y })); } } } } -/// Cette fonction return un ellement aleatoir entre de la Grass Hill et Forest +/// Cette fonction return un ellement aleatoire entre de la Grass Hill et Forest fn generate_random_tile_for_map() -> Tile { let mut rng = rand::thread_rng(); match rng.gen_range(1..=4) {