why doesnt it work | Sololearn: Learn to code for FREE!
Neuer Kurs! Jeder Programmierer sollte generative KI lernen!
Kostenlose Lektion ausprobieren
0

why doesnt it work

so this code should give us a pvp version of tic tac toe. when I start the code I see the grid but for some reson it doesn't respond when I click. why import os import pygame from pygame.locals import* pygame.init() ev = pygame.event.get() x=0 y=0 window=pygame.display.set_mode((700,700)) background=pygame.image.load('blanc.png') grille=pygame.image.load('Tic-tac-toe.png') window.blit(background,(0,0)) window.blit(grille,(50,50)) x=pygame.image.load("X-400.png") o=pygame.image.load("o.png") GRID=[0,0,0, 0,0,0, 0,0,0] tour=1 a=tour/2 if a==int(a): tour=tour+1 elif a!=int(a): tour=tour+1 pygame.mouse.set_visible for event in ev: if event.type ==MOUSEBUTTONDOWN and event.button == 1: pygame.mouse.get_pos(x,y) if x<239: if y<242 and GRID[1]==0: window.blit(X-400,(50,50)) GRID[1]=1 elif 275<y<382: window.blit(X-400,(50,275)) GRID[4]=1 elif y>468: window.blit(X-400,(50,468)) GRID[7]=1 elif 275<x<377: if y<242: window.blit(X-400,(275,50)) GRID[2]=1 elif 275<y<382: window.blit(X-400,(275,275)) GRID[5]=1 elif y>468: window.blit(X-400,(275,468)) GRID[8]=1 elif x>461: if y<242: window.blit(X-400,(461,50)) GRID[3]=1 elif 275<y<382: window.blit(X-400,(461,275)) GRID[6]=1 elif y>468: window.blit(X-400,(461,468)) GRID[9]=1 if event.type ==MOUSEBUTTONDOWN and event.button == 2: pygame.mouse.get_pos(x,y) if x<239: if y<242: window.blit(o,(50,50)) GRID[1]=2 elif 275<y<382: window.blit(o,(50,275)) GRID[4]=2 elif y>468: window.blit(o,(50,468)) GRID[7]=2 elif 275<x<377: if

26th Apr 2017, 8:37 PM
Emmanuel Nassour
Emmanuel Nassour - avatar
1 Antwort
+ 1
Your code is not complete. Please post the full code using public code in your code playground.
26th Apr 2017, 9:16 PM
Yusuf Malikul Mulki
Yusuf Malikul Mulki - avatar