generated from tipragot/rust
This commit is contained in:
parent
ac1fb70b32
commit
9f78f7be49
|
@ -5,21 +5,30 @@ use bevy::ecs::component;
|
||||||
use noise::{NoiseFn, Perlin};
|
use noise::{NoiseFn, Perlin};
|
||||||
|
|
||||||
|
|
||||||
|
/// The different types of tiles in the map.
|
||||||
#[derive(Clone, Copy, component::Component, Debug, PartialEq, Eq)]
|
#[derive(Clone, Copy, component::Component, Debug, PartialEq, Eq)]
|
||||||
enum Tile {
|
enum Tile {
|
||||||
|
/// The forest tile.
|
||||||
Forest,
|
Forest,
|
||||||
|
|
||||||
|
/// The hill tile.
|
||||||
Hill,
|
Hill,
|
||||||
|
|
||||||
|
/// The grass tile (nothing).
|
||||||
Grass,
|
Grass,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Postion component of tile in the map.
|
||||||
#[derive(component::Component, Debug)]
|
#[derive(component::Component, Debug)]
|
||||||
struct Position(f64, f64);
|
struct Position(f64, f64);
|
||||||
|
|
||||||
|
/// Adjacent entities of tile in the map.
|
||||||
#[derive(component::Component)]
|
#[derive(component::Component)]
|
||||||
struct AdjacentCases {
|
struct AdjacentCases {
|
||||||
entities: Vec<Entity>,
|
entities: Vec<Entity>,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Generate the map coordinates with a size.
|
||||||
fn generate_map_coordinates(size: i32) -> Vec<Vec<(f64, f64)>> {
|
fn generate_map_coordinates(size: i32) -> Vec<Vec<(f64, f64)>> {
|
||||||
let mut all_tiles = Vec::new();
|
let mut all_tiles = Vec::new();
|
||||||
// Iterate over horizontal lines of the map
|
// Iterate over horizontal lines of the map
|
||||||
|
|
Loading…
Reference in a new issue