1

I made several drawn squares for my basic game. The problem occurs when I tried to make them clickable. I've searched around 2 hours in google but could not found similar topic to my specific problem.

here is my code:

while running:
    for event in pygame.event.get():
        if event.type == pygame.QUIT:
            running = False

    sq1 = pygame.draw.rect(surface=screen, color="white", rect=[20, 100, 100, 100], )
    sq2 = pygame.draw.rect(surface=screen, color="White", rect=[150, 100, 100, 100], )
    sq3 = pygame.draw.rect(surface=screen, color="White", rect=[280, 100, 100, 100], )
    sq4 = pygame.draw.rect(surface=screen, color="White", rect=[20, 230, 100, 100], )
    sq5 = pygame.draw.rect(surface=screen, color="White", rect=[150, 230, 100, 100], )
    sq6 = pygame.draw.rect(surface=screen, color="White", rect=[280, 230, 100, 100], )
    sq7 = pygame.draw.rect(surface=screen, color="White", rect=[20, 360, 100, 100], )
    sq8 = pygame.draw.rect(surface=screen, color="White", rect=[150, 360, 100, 100], )
    sq9 = pygame.draw.rect(surface=screen, color="White", rect=[280, 360, 100, 100], )
    pygame.display.update()

the game will be "tic tac toe"

Could you give me any suggestions of how to make them alive. I want onclick to appears "X" or "O".

CrazyChucky
  • 3,263
  • 4
  • 11
  • 25
wiwoucho
  • 19
  • 1

0 Answers0