nom de variable + doc
This commit is contained in:
parent
789a7ab223
commit
562b965c8b
12
src/map.rs
12
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) {
|
||||
|
|
Loading…
Reference in a new issue