Work on levelgenerator

This commit is contained in:
2023-12-04 18:41:21 +01:00
parent 2eeb95e3a3
commit aa3fa6efb1
5 changed files with 431 additions and 0 deletions

View File

@@ -8,6 +8,8 @@ pub const LEVEL_HEIGHT: usize = 25;
#[derive(Copy, Clone, Debug, PartialEq)]
pub enum StructureElement {
Start,
End,
Wall,
Floor,
StairDown,
@@ -21,6 +23,10 @@ pub struct Level {
discovered: [[bool; LEVEL_HEIGHT]; LEVEL_WIDTH],
monsters: Vec<Monster>,
artifacts: Vec<Box<dyn Artifact>>,
/// the position of the start in the level (eiter stair up or start point)
start: (usize, usize),
/// the position of the end in the level (eiter stair down or end point)
end: (usize, usize),
}
impl Level {
@@ -37,6 +43,8 @@ impl Level {
discovered: [[false; LEVEL_HEIGHT]; LEVEL_WIDTH],
monsters: Vec::with_capacity(10),
artifacts: Vec::with_capacity(10),
start: (0,0),
end: (0,0),
}
}
pub fn get_element(&mut self, x: i16, y: i16) -> (Option<StructureElement>, Option<&mut Monster>, Option<&mut Box<(dyn Artifact + 'static)>>) {