merged GameOverScreen branch

This commit is contained in:
JakubR 2021-05-18 19:46:04 +02:00
parent cc7c556d0c
commit 9918bf64d8

18
main.py
View File

@ -171,25 +171,25 @@ def main():
while running and is_game_over: while running and is_game_over:
clock.tick(const.V_FPS) clock.tick(const.V_FPS)
const.SCREEN.fill((255, 255, 255)) const.SCREEN.fill((255, 255, 255))
tb = TextBox(position=(150, 200),dimensions= (500, 100),text="Game Over") tb = TextBox(position=(150, 200), dimensions=(500, 100), text="Game Over")
cont = Button(position=(350, 350),dimensions= (100, 50),text="Try again") cont = Button(position=(350, 350), dimensions=(100, 50), text="Try again")
close = Button(position=(350, 450), dimensions=(100, 50), text="Close") close = Button(position=(350, 450), dimensions=(100, 50), text="Close")
ev =pygame.event.get() ev = pygame.event.get()
if close.is_clicked(pygame.mouse.get_pos(),ev): if close.is_clicked(pygame.mouse.get_pos(), ev):
running=False running = False
if cont.is_clicked(pygame.mouse.get_pos(),ev): if cont.is_clicked(pygame.mouse.get_pos(), ev):
minefield = mf.Minefield(const.MAP_RANDOM_10x10) minefield = mf.Minefield(const.MAP_RANDOM_10x10)
agent = minefield.agent agent = minefield.agent
in_menu = True in_menu = True
is_game_over = False is_game_over = False
for component in ui_components_list.selectable_ui_components: for component in ui_components_list.selectable_ui_components:
component.set_flags(is_active=True) component.set_flags(is_active=True)
cont.draw(const.SCREEN,pygame.mouse.get_pos()) cont.draw(const.SCREEN, pygame.mouse.get_pos())
close.draw(const.SCREEN,pygame.mouse.get_pos()) close.draw(const.SCREEN, pygame.mouse.get_pos())
tb.draw(const.SCREEN) tb.draw(const.SCREEN)
pygame.display.flip() pygame.display.flip()
#is_game_over = False # is_game_over = False
if __name__ == "__main__": if __name__ == "__main__":