ADD show health option
This commit is contained in:
@@ -14,7 +14,7 @@ class Game(GameState):
|
||||
match_data_path = f"maps/{self.match.map_name}.json"
|
||||
match_image_path = f"maps/{self.match.map_name}.png"
|
||||
|
||||
# Map Coordinate Helper Class, misnamed
|
||||
# Map Coordinate Helper Class,
|
||||
self.map_coord_controller = MapCoordConverter(self.screen.get_width(), self.screen.get_height(), match_data_path, match_image_path)
|
||||
|
||||
# Renderers
|
||||
|
||||
@@ -14,12 +14,16 @@ class SettingsMenu(GameState):
|
||||
self.show_yaw_text = self.font.render("Show Yaw: ", True, (255, 255, 255))
|
||||
self.show_yaw_button = Switch(100, 100, 50, 50, self.options["show_yaw"])
|
||||
|
||||
self.show_health_text = self.font.render("Show Health: ", True, (255, 255, 255))
|
||||
self.show_health_button = Switch(100, 150, 50, 50, self.options["show_health"])
|
||||
|
||||
def handle_events(self, events):
|
||||
"""Handles user inputs."""
|
||||
for event in events:
|
||||
if event.type == pygame.KEYDOWN and event.key == pygame.K_ESCAPE:
|
||||
self.switch_state("start_menu")
|
||||
self.show_yaw_button.handle_event(event)
|
||||
self.show_health_button.handle_event(event)
|
||||
self.back_button.handle_event(event)
|
||||
|
||||
def update(self):
|
||||
@@ -29,6 +33,11 @@ class SettingsMenu(GameState):
|
||||
else:
|
||||
self.options["show_yaw"] = False
|
||||
|
||||
if self.show_health_button.get_is_toggled():
|
||||
self.options["show_health"] = True
|
||||
else:
|
||||
self.options["show_health"] = False
|
||||
|
||||
# Save settings to context
|
||||
self.context["options"] = self.options
|
||||
|
||||
@@ -38,5 +47,11 @@ class SettingsMenu(GameState):
|
||||
self.screen.blit(self.show_yaw_text, (self.show_yaw_button.x + self.show_yaw_button.width + 10,
|
||||
self.show_yaw_button.y))
|
||||
self.show_yaw_button.draw(self.screen)
|
||||
|
||||
self.screen.blit(self.show_health_text, (self.show_health_button.x + self.show_health_button.width + 10,
|
||||
self.show_health_button.y))
|
||||
self.show_health_button.draw(self.screen)
|
||||
|
||||
self.back_button.draw(self.screen)
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user