Monsters can attack player now

This commit is contained in:
2023-12-30 16:31:27 +01:00
parent b88bc67c50
commit b3d64f7438
3 changed files with 20 additions and 12 deletions

View File

@@ -43,8 +43,6 @@ impl Game {
g
}
/// returns true if the player is dead (life <= 0)
fn player_is_dead(&self) -> bool { self.get_player().get_life() <= 0 }
/// returns true if the player is standing on the End element
fn player_reached_goal(&mut self) -> bool {
match self.next_element(0, 0) {
@@ -60,7 +58,7 @@ impl Game {
}
/// returns the state of the game (depending on player's life and position)
pub fn get_game_state(&mut self) -> GameState {
if self.player_is_dead() {
if self.player.is_dead() {
return GameState::LOST;
}
if self.player_reached_goal() {