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 744d9b646e - Show all commits

View file

@ -52,7 +52,6 @@ fn generate_map(
if let (Some(perlin), Some(spiral)) = (noise.as_ref(), map_iterator.as_mut()) {
CoCo_Sol marked this conversation as resolved Outdated

You can use the let else syntax to remove one level of nesting.

You can use the let else syntax to remove one level of nesting.

if I use the "else let" keyword, the nesting level is the same

if I use the "else let" keyword, the nesting level is the same

No because you do an early return

No because you do an early return

I have to write an unwrap so ?

I have to write an unwrap so ?

No, an let else

No, an let else
if let Some(position) = spiral.next() {
let pixel_position = position.to_pixel_coordinates((0.1, 0.1));
commands.spawn((get_type_tile(pixel_position, perlin), position));
} else {
end_map_event.send(EndMapGenerationEvent);
@ -76,7 +75,7 @@ fn get_type_tile(position: (f32, f32), noise: &Perlin) -> Tile {
fn delete_map(
CoCo_Sol marked this conversation as resolved Outdated

I still think you should take an HexPosition, this will be simpler and will make this function simpler to use.

I still think you should take an HexPosition, this will be simpler and will make this function simpler to use.
mut commands: Commands,
query: Query<Entity, With<Tile>>,
CoCo_Sol marked this conversation as resolved Outdated

get_tile_type

get_tile_type
mut event: EventReader<EndMapGenerationEvent>,
mut event: EventReader<MapGenerationEvent>,
CoCo_Sol marked this conversation as resolved Outdated

This is not a Zoom, it is a Scale

This is not a Zoom, it is a Scale
) {
for _ in event.read() {
for entity in query.iter() {