summaryrefslogtreecommitdiff
path: root/dungeon/src/entity.rs
diff options
context:
space:
mode:
authorRyan Symons <47405201+rsymons22@users.noreply.github.com>2025-11-04 22:24:23 -0500
committerRyan Symons <47405201+rsymons22@users.noreply.github.com>2025-11-04 22:24:23 -0500
commit574f3c694dcce927ac87dfb79276775f0904bdc8 (patch)
treebebe583ec5194c4a5a3187c04b79d0c84215e1b8 /dungeon/src/entity.rs
parentAdd SDL feature flag (fixes wayland issues) (diff)
downloadDungeonCrawl-574f3c694dcce927ac87dfb79276775f0904bdc8.tar.gz
DungeonCrawl-574f3c694dcce927ac87dfb79276775f0904bdc8.tar.bz2
DungeonCrawl-574f3c694dcce927ac87dfb79276775f0904bdc8.zip
Added enemy code structure and test movement
Diffstat (limited to 'dungeon/src/entity.rs')
-rw-r--r--dungeon/src/entity.rs7
1 files changed, 7 insertions, 0 deletions
diff --git a/dungeon/src/entity.rs b/dungeon/src/entity.rs
index 02184a9..5f0425f 100644
--- a/dungeon/src/entity.rs
+++ b/dungeon/src/entity.rs
@@ -21,6 +21,7 @@ pub enum Item {
pub enum EntityKind {
/// The main player
Player,
+ Enemy,
/// An item (not in an inventory) on the floor of the dungeon
Item(Item),
}
@@ -89,6 +90,12 @@ impl Entity {
let health = Some(PLAYER_FULL_HEALTH);
Self::new(pos, dir, kind, health)
}
+
+ pub const fn enemy(pos: Pos, health: u32) -> Self {
+ let dir = Direction::East;
+ let kind = EntityKind::Enemy;
+ Self::new(pos, dir, kind, Some(health))
+ }
}
/// The `Player` type represents the main player entity