diff --git a/src/door.py b/src/door.py index 61a8fa7..5b388fb 100644 --- a/src/door.py +++ b/src/door.py @@ -10,4 +10,22 @@ class Door: self.max_hp = hp_value self.current_hp = hp_value - self.is_closed = False \ No newline at end of file + self.is_closed = False + + self.door_color = (245, 245, 220) + self.door_border_color = (100, 90, 80) + + def draw(self, screen): + # main space of the door with 20x100 px + pygame.draw.rect(screen, self.door_color, (self.x, self.y, 20, 100)) + + # doorframe 3px + pygame.draw.rect(screen, self.door_border_color, (self.x, self.y, 20, 100), 3) + + # when attacked and gets dmg reduces the health (if closed), door "breaks" when health = 0 + def take_damage(self, amount): + if self.is_closed: + self.current_hp -= amount + if self.current_hp <= 0: + self.current_hp = 0 + self.is_closed = False \ No newline at end of file