diff --git a/src/door.py b/src/door.py index 5b388fb..7bfc636 100644 --- a/src/door.py +++ b/src/door.py @@ -1,5 +1,13 @@ import pygame +from src.settings import ( + DOOR_WIDTH, + DOOR_HEIGHT, + DOOR_BORDER_WIDTH, + COLOR_DOOR_BEIGE, + COLOR_DOOR_BORDER +) + # using class to be able to reuse it # as we will have multiple rooms to go in class Door: @@ -12,15 +20,15 @@ class Door: self.current_hp = hp_value self.is_closed = False - self.door_color = (245, 245, 220) - self.door_border_color = (100, 90, 80) + self.door_color = COLOR_DOOR_BEIGE + self.door_border_color = COLOR_DOOR_BORDER 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)) + # door + pygame.draw.rect(screen, self.door_color, (self.x, self.y, DOOR_WIDTH, DOOR_HEIGHT)) - # doorframe 3px - pygame.draw.rect(screen, self.door_border_color, (self.x, self.y, 20, 100), 3) + # doorframe + pygame.draw.rect(screen, self.door_border_color, (self.x, self.y, DOOR_WIDTH, DOOR_HEIGHT), DOOR_BORDER_WIDTH) # when attacked and gets dmg reduces the health (if closed), door "breaks" when health = 0 def take_damage(self, amount): diff --git a/src/settings.py b/src/settings.py index 4055ea3..edece49 100644 --- a/src/settings.py +++ b/src/settings.py @@ -2,3 +2,13 @@ DESK_WIDTH = 70 DESK_HEIGHT = 40 + +# --- DOOR --- +DOOR_WIDTH = 20 +DOOR_HEIGHT = 100 +DOOR_BORDER_WIDTH = 3 + +COLOR_DOOR_BEIGE = (245, 245, 220) +COLOR_DOOR_BORDER = (100, 90, 80) +COLOR_HP_BAR_GREEN = (0, 255, 0) +COLOR_HP_BAR_BG = (50, 50, 50) \ No newline at end of file