mirror of https://git.sr.ht/~garritfra/midgard
Garrit Franke
3 years ago
2 changed files with 30 additions and 33 deletions
@ -0,0 +1,22 @@
|
||||
use rltk::RandomNumberGenerator; |
||||
|
||||
#[derive(PartialEq, Copy, Clone)] |
||||
pub enum TileType { |
||||
Wall, |
||||
Floor, |
||||
} |
||||
|
||||
pub fn new_chunk(seed: u64) -> Vec<TileType> { |
||||
let mut map = vec![TileType::Floor; 80 * 50]; |
||||
let count = map.len(); |
||||
|
||||
// TODO: Lift seed to game state and pass to this method
|
||||
let mut rng = RandomNumberGenerator::seeded(seed); |
||||
|
||||
// Place obstacles
|
||||
for _ in 0..20 { |
||||
map[rng.range(0, count)] = TileType::Wall; |
||||
} |
||||
|
||||
map |
||||
} |
Loading…
Reference in new issue