type tile generation
All checks were successful
Rust Checks / checks (push) Successful in 1m55s

This commit is contained in:
CoCo_Sol 2024-02-15 11:10:42 +01:00
parent 061c043d91
commit 178cf417cf

View file

@ -63,8 +63,9 @@ fn generate_map_tiles(
}
/// Gets the type of the tile at the given position with a perlin noise
fn get_type_tile(perlin: Perlin, position: HexPosition<i32>) -> TypeTile {
// TODO:Implement the pixel coordinate system
let value = perlin.get([position.q as f64, position.r as f64]);
let pixel_position = position.to_pixel_coordinates((0.5, 0.5));
let coordonate = [pixel_position.0 as f64, pixel_position.1 as f64];
let value = perlin.get(coordonate);
match value {
v if v <= -0.3 => TypeTile::Hill,
v if v >= 0.3 => TypeTile::Forest,