From 574f3c694dcce927ac87dfb79276775f0904bdc8 Mon Sep 17 00:00:00 2001 From: Ryan Symons <47405201+rsymons22@users.noreply.github.com> Date: Tue, 4 Nov 2025 22:24:23 -0500 Subject: Added enemy code structure and test movement --- dungeon/src/lib.rs | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) (limited to 'dungeon/src/lib.rs') 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, } impl Dungeon { /// Creates a new `Dungeon`. @@ -65,6 +69,16 @@ impl From 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, + } } } -- cgit v1.2.3-freya