Merge pull request 'ESC chyba naprawiony(ale pewnie i tak zaraz znajdziemy jakiegos buga xd)' (#23) from problemy_z_ESC into master

Reviewed-on: s464965/WMICraft#23
This commit is contained in:
Juliusz Sadowski 2022-04-28 14:24:49 +02:00
commit 7030488a8a

View File

@ -20,13 +20,13 @@ class Game:
pygame.display.set_icon(pygame.image.load('./resources/icons/sword.png'))
self.screen = pygame.display.set_mode((WINDOW_WIDTH, WINDOW_HEIGHT))
self.logs = Logs(self.screen)
self.clock = pygame.time.Clock()
self.bg = pygame.image.load("./resources/textures/bg.jpg")
self.screens = {'credits': Credits(self.screen, self.clock), 'options': Options(self.screen, self.clock)}
self.level = Level(self.screen, self.logs)
def main_menu(self):
menu = MainMenu(self.screen, self.clock, self.bg,
@ -36,7 +36,8 @@ class Game:
menu.display_screen()
def game(self):
health_bar = HealthBar(self.screen, pygame.Rect(150, 150, 100, 15), 100, 100)
logs = Logs(self.screen)
level = Level(self.screen, logs)
stats = Stats(self.screen)
# setup clock for rounds
@ -44,7 +45,7 @@ class Game:
pygame.time.set_timer(NEXT_TURN, TURN_INTERVAL)
# create level
self.level.create_map()
level.create_map()
print_numbers_flag = False
running = True
@ -63,11 +64,11 @@ class Game:
if event.key == pygame.K_r:
stats.red_team_hp_bar.take_dmg(5)
if event.type == NEXT_TURN: # is called every 'TURN_INTERVAL' milliseconds
self.level.handle_turn()
level.handle_turn()
stats.update()
self.logs.draw()
self.level.update()
logs.draw()
level.update()
if print_numbers_flag:
print_numbers()