Monsters can attack player now
This commit is contained in:
@@ -28,9 +28,11 @@ impl Player {
|
||||
pub fn change_life(&mut self, by: i16) {
|
||||
self.life = max(0, min(self.max_life, self.life + by));
|
||||
}
|
||||
/// returns true if the player is dead (life <= 0)
|
||||
pub fn get_life(&self) -> i16 {
|
||||
self.life
|
||||
}
|
||||
pub fn is_dead(&self) -> bool { self.life <= 0 }
|
||||
pub fn get_max_life(&self) -> i16 {
|
||||
self.max_life
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user