generated from tipragot/rust
Adding a map creation plugin #57
|
@ -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
|
||||
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
tipragot
commented
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
tipragot
commented
get_tile_type get_tile_type
|
||||
mut event: EventReader<EndMapGenerationEvent>,
|
||||
mut event: EventReader<MapGenerationEvent>,
|
||||
CoCo_Sol marked this conversation as resolved
Outdated
tipragot
commented
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() {
|
||||
|
|
Loading…
Reference in a new issue
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
No because you do an early return
I have to write an unwrap so ?
No, an let else