Jan-03-2023, 04:01 PM
(This post was last modified: Jan-06-2023, 12:44 AM by Yoriz.
Edit Reason: removed unnecessary quote of previous post
)
Yeah, makes sense, thanks.
And for text that you said, I searched for some examples all over the internet (in my case how to display "you win" and "computer wins"), copied and mixed some parts (which are repeating almost all the time) but can't make it work.
I tried to display "game over" just to see if it works but nothing, I suppose because of an infinite loop until I exit the window.
And for text that you said, I searched for some examples all over the internet (in my case how to display "you win" and "computer wins"), copied and mixed some parts (which are repeating almost all the time) but can't make it work.
I tried to display "game over" just to see if it works but nothing, I suppose because of an infinite loop until I exit the window.
running = True while running: for event in pygame.event.get(): if event.type == pygame.QUIT: running = False elif event.type == pygame.MOUSEBUTTONDOWN: if cube.done(): text = font.render("Game Over", True, (255,255,255)) text_rect = text.get_rect() text_x = surface.get_width() / 2 - text_rect.width / 2 text_y = surface.get_height() / 2 - text_rect.height / 2 surface.blit(text, [text_x, text_y]) cube.reset() else: cube.click(pygame.Vector2(event.pos)) pygame.event.clear() if cube.mark == ROBOT and not cube.done(): cube.draw(surface) cube.play(robot.play(), "O") cube.draw(surface)