Skip to content

Commit

Permalink
Removing the use of hud, adding a simple health bar and score
Browse files Browse the repository at this point in the history
  • Loading branch information
Miłosz Bochenek committed Jan 13, 2024
2 parents 9794d06 + e51666e commit b10e417
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 0 deletions.
Binary file added raycaster/assets/hud/face.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 4 additions & 0 deletions raycaster/core/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,10 @@ class Settings:
MINIMAP_RATIO = 0.25
MINIMAP_OPACITY_RATIO = 0.33

# HUD RELATED
HUD_VISIBLE = True # Press F5 to change
HUD_RATIO_HEIGHT = 0.15

def __new__(cls):
if cls._instance is None:
cls._instance = super(Settings, cls).__new__(cls)
Expand Down
8 changes: 8 additions & 0 deletions raycaster/game/asset_loader.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ def __new__(cls):
cls.WALL_TEXTURES_PATH = os.path.join(cls.ASSETS_PATH, "walls")
cls.OBJECTS_SPRITES_PATH = os.path.join(cls.ASSETS_PATH, "objects")
cls.STATIC_SPRITES_PATH = os.path.join(cls.OBJECTS_SPRITES_PATH, "static")
<<<<<<< HEAD
cls.ANIMATED_SPRITES_PATH = os.path.join(
cls.OBJECTS_SPRITES_PATH, "animated"
)
Expand All @@ -38,6 +39,13 @@ def __new__(cls):

cls._walls = cls._load_walls_textures()
cls._static_objects = cls._load_static_sprites()
=======
cls.HUD_TEXTURES_PATH = os.path.join(cls.ASSETS_PATH, "hud")

cls._walls = cls._load_walls_textures()
cls._static_objects = cls._load_static_sprites()
cls._hud_face = cls._load_hud_textures()
>>>>>>> e51666e41d05d7b58d0550781750d9bbe27b9bc6

return cls._instance

Expand Down
4 changes: 4 additions & 0 deletions raycaster/rendering/gui_renderer.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,11 @@ def __init__(
self.raycaster = raycaster
self.player = player
self.map = map
<<<<<<< HEAD
self.font = pygame.font.Font("raycaster/assets/fonts/DooM.ttf", 15)
=======
self.hud_textures = AssetLoader()._hud_face
>>>>>>> e51666e41d05d7b58d0550781750d9bbe27b9bc6

def _draw_walls_on_minimap(self, surface: pygame.Surface, minimap_scale: float):
for x, y in self.map.walls:
Expand Down

0 comments on commit b10e417

Please sign in to comment.