diff options
Diffstat (limited to 'src/game.rs')
-rw-r--r-- | src/game.rs | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/src/game.rs b/src/game.rs index eee0b7c0d513..dd45b3009a37 100644 --- a/src/game.rs +++ b/src/game.rs @@ -227,6 +227,17 @@ impl<'a> Game<'a> { Ok(()) } + /// Draw all the game entities to the screen + fn draw_entities_at(&mut self, pos: Position) -> io::Result<()> { + for entity in self.entities.at(pos) { + self.viewport.draw( + entity, + &self.entities.neighbor_entities(entity.position()), + )?; + } + Ok(()) + } + /// Draw the game entity with the given ID, if any, to the screen fn draw_entity(&mut self, entity_id: EntityID) -> io::Result<bool> { if let Some(entity) = self.entities.get(entity_id) { @@ -438,6 +449,7 @@ impl<'a> Game<'a> { self.viewport.game_cursor_position = character.position; self.viewport.clear(old_pos)?; + self.draw_entities_at(old_pos)?; self.draw_entity(self.character_entity_id)?; self.tick( self.character().speed().tiles_to_ticks( |