Adding a map creation plugin #57

Merged
CoCo_Sol merged 39 commits from map-generation into main 2024-02-21 20:10:03 +00:00
Showing only changes of commit 0caf97d9b8 - Show all commits

View file

@ -40,7 +40,7 @@ pub struct EndMapGeneration;
/// Generate each tiles of the map if the [StartMapGeneration] is received. /// Generate each tiles of the map if the [StartMapGeneration] is received.
/// ///
/// The map is generated using the [Perlin] noise function and the [HexSpiral]. /// The map is generated using a [Perlin] noise and a [HexSpiral].
/// ///
/// It's generated one tile at a time, until the spiral is finished. /// It's generated one tile at a time, until the spiral is finished.
fn generate_map( fn generate_map(
@ -74,7 +74,7 @@ fn generate_map(
} }
/// Returns the type of the [HexPosition] with the given noise. /// Returns the type of the [HexPosition] with the given noise.
fn get_type_tile(position: HexPosition<i32>, noise: &Perlin) -> Tile { fn get_tile_type(position: HexPosition<i32>, noise: &Perlin) -> Tile {
let pixel_position = position.to_pixel_coordinates() / MAP_GENERATION_ZOOM; let pixel_position = position.to_pixel_coordinates() / MAP_GENERATION_ZOOM;
let value = noise.get([pixel_position.x as f64, pixel_position.y as f64]); let value = noise.get([pixel_position.x as f64, pixel_position.y as f64]);
match value { match value {