ADD player state tracking

This commit is contained in:
2025-04-26 20:05:26 +02:00
parent 43c23d8e60
commit e6e1985a4f
8 changed files with 66 additions and 13 deletions

27
render/info_renderer.py Normal file
View File

@@ -0,0 +1,27 @@
import pygame
class InfoRenderer:
def __init__(self, screen, styling):
self.screen = screen
self.styling = styling
self.font = self.styling["small_font"]
self.selected_player = None
# Private methods
def _draw_player_info(self):
"""Draws the player info on the screen."""
if self.selected_player is None:
return
player_info = f"Player: {self.selected_player.name}\n"
player_info += f"Active Weapon: {self.selected_player.current_weapon}\n"
player_info += f"Health: {self.selected_player.health}\n"
text_surface = self.font.render(player_info, True, self.styling["text_colour"])
self.screen.blit(text_surface, (10, 100))
# Public methods
def render(self):
"""Renders the info on the screen."""
self._draw_player_info()