refactor: fix formatting and set game window title to "Silent FH"
This commit is contained in:
+10
-9
@@ -46,6 +46,7 @@ class Game:
|
||||
pygame.init()
|
||||
self.screen = pygame.display.set_mode((screen_w, screen_h))
|
||||
self.clock = pygame.time.Clock()
|
||||
pygame.display.set_caption("Silent FH")
|
||||
self.font = pygame.font.SysFont("monospace", 22, bold=True)
|
||||
self.item_font = pygame.font.SysFont("Arial", 16, bold=True)
|
||||
self.running = True
|
||||
@@ -172,7 +173,7 @@ class Game:
|
||||
- (keys[pygame.K_LEFT] or keys[pygame.K_a]),
|
||||
(keys[pygame.K_DOWN] or keys[pygame.K_s])
|
||||
- (keys[pygame.K_UP] or keys[pygame.K_w]),
|
||||
)
|
||||
)
|
||||
|
||||
if movement.length_squared() == 0:
|
||||
return movement
|
||||
@@ -190,9 +191,9 @@ class Game:
|
||||
return self.map.is_accessible(column, row)
|
||||
|
||||
def is_player_at_desk(
|
||||
self,
|
||||
player_rect: Optional[pygame.Rect] = None,
|
||||
room_rect: Optional[pygame.Rect] = None,
|
||||
self,
|
||||
player_rect: Optional[pygame.Rect] = None,
|
||||
room_rect: Optional[pygame.Rect] = None,
|
||||
) -> bool:
|
||||
"""Return True while the player's hitbox touches a desk in the current room."""
|
||||
|
||||
@@ -206,9 +207,9 @@ class Game:
|
||||
return any(desk.check_collision(player_rect) for desk in self.map.get_desks_for_room(room_rect))
|
||||
|
||||
def update_tower(
|
||||
self,
|
||||
room_rect: Optional[pygame.Rect],
|
||||
is_at_desk: bool,
|
||||
self,
|
||||
room_rect: Optional[pygame.Rect],
|
||||
is_at_desk: bool,
|
||||
) -> None:
|
||||
"""Spawn a tower after the player studies at a table, then let it attack."""
|
||||
|
||||
@@ -358,8 +359,8 @@ class Game:
|
||||
tile_size,
|
||||
)
|
||||
if (
|
||||
room_rect.left <= tile_rect.centerx <= room_rect.right
|
||||
and room_rect.bottom <= tile_rect.centery <= room_rect.bottom + 2 * tile_size
|
||||
room_rect.left <= tile_rect.centerx <= room_rect.right
|
||||
and room_rect.bottom <= tile_rect.centery <= room_rect.bottom + 2 * tile_size
|
||||
):
|
||||
door_tiles.append(tile_rect)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user