summaryrefslogtreecommitdiff
path: root/dungeon/src/lib.rs
diff options
context:
space:
mode:
authorFreya Murphy <freya@freyacat.org>2025-11-07 18:34:12 -0500
committerFreya Murphy <freya@freyacat.org>2025-11-07 18:34:12 -0500
commitdfee38af9faffb54822300836bcc55a406410426 (patch)
tree00ae700549cbfd8c0135c393d3315f301319b269 /dungeon/src/lib.rs
parentgraphics: add direction based entity rendering (diff)
downloadDungeonCrawl-dfee38af9faffb54822300836bcc55a406410426.tar.gz
DungeonCrawl-dfee38af9faffb54822300836bcc55a406410426.tar.bz2
DungeonCrawl-dfee38af9faffb54822300836bcc55a406410426.zip
dungeon: fix placeholder zombie from spawning in walls
Diffstat (limited to 'dungeon/src/lib.rs')
-rw-r--r--dungeon/src/lib.rs8
1 files changed, 2 insertions, 6 deletions
diff --git a/dungeon/src/lib.rs b/dungeon/src/lib.rs
index cb57bf0..e85b718 100644
--- a/dungeon/src/lib.rs
+++ b/dungeon/src/lib.rs
@@ -65,17 +65,13 @@ impl Default for Dungeon {
}
}
impl From<Floor> for Dungeon {
- fn from(floor: Floor) -> Self {
+ fn from(mut floor: Floor) -> Self {
let player = Player::new(floor.player_start());
// TODO: initalize rest of game state
// TODO: Randomize enemy positions/types
- let enemies = vec![Enemy::new(
- EnemyType::Zombie,
- Pos::new(player.entity.pos.x() + 4, player.entity.pos.y())
- .unwrap_or(const_pos!(1, 1)),
- )];
+ let enemies = vec![Enemy::new(EnemyType::Zombie, floor.random_pos())];
Self {
floor,