diff options
| author | Ryan Symons <47405201+rsymons22@users.noreply.github.com> | 2025-11-04 22:24:23 -0500 |
|---|---|---|
| committer | Ryan Symons <47405201+rsymons22@users.noreply.github.com> | 2025-11-04 22:24:23 -0500 |
| commit | 574f3c694dcce927ac87dfb79276775f0904bdc8 (patch) | |
| tree | bebe583ec5194c4a5a3187c04b79d0c84215e1b8 /dungeon/src/lib.rs | |
| parent | Add SDL feature flag (fixes wayland issues) (diff) | |
| download | DungeonCrawl-574f3c694dcce927ac87dfb79276775f0904bdc8.tar.gz DungeonCrawl-574f3c694dcce927ac87dfb79276775f0904bdc8.tar.bz2 DungeonCrawl-574f3c694dcce927ac87dfb79276775f0904bdc8.zip | |
Added enemy code structure and test movement
Diffstat (limited to 'dungeon/src/lib.rs')
| -rw-r--r-- | dungeon/src/lib.rs | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/dungeon/src/lib.rs b/dungeon/src/lib.rs index 39d7c60..8119119 100644 --- a/dungeon/src/lib.rs +++ b/dungeon/src/lib.rs @@ -2,6 +2,7 @@ //! interacting with a `Dungeon` and its components. mod bsp; +mod enemy; mod entity; mod map; mod pos; @@ -11,12 +12,15 @@ pub use entity::*; pub use map::*; pub use pos::*; +use crate::enemy::{Enemy, EnemyType}; + /// The `Dungeon` type represents the game state of the /// dungeon crawler. #[derive(Clone, Debug, PartialEq)] pub struct Dungeon { pub floor: Floor, pub player: Player, + pub enemies: Vec<Enemy>, } impl Dungeon { /// Creates a new `Dungeon`. @@ -65,6 +69,16 @@ impl From<Floor> for Dungeon { // TODO: initalize rest of game state - Self { floor, player } + // TODO: How will we randomize enemy type/number per floor? + let enemies = vec![Enemy::new( + EnemyType::Zombie, + Pos::new(player.entity.pos.x() + 4, player.entity.pos.y()).unwrap(), + )]; + + Self { + floor, + player, + enemies, + } } } |