Work on levelgenerator
This commit is contained in:
@@ -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)>>) {
|
||||
|
||||
Reference in New Issue
Block a user