I am working on a Tic Tac Toe Program, But when I am trying to decode my assigned thingie so, can you fix it for me, please? also is there another way I can do this if you can't fix it pls you can also use this code if you want its my own code :)
Here is the Code :
# Initalize pygame
pygame.init()
# Creating the Window
win = pygame.display.set_mode((500 , 500))
# Font
font = pygame.font.Font('freesansbold.ttf', 32)
# Variables
Blackk = 0 , 0 , 0
Redd = 255 , 0 , 0
Bluee = 0 , 0 , 255
Character = ""
# X or O
x_o = random.randint( 0 , 1 )
if x_o == 1:
Character == "X"
elif x_o == 0:
Character == "O"
STR_xo = str("You ARE \n" , Character)
# Text
You_R = font.render((STR_xo) , True , Blackk , (240 , 240 , 240))
# Make it Rect
textRect = You_R.get_rect()
# Title And Icon
pygame.display.set_caption("Tic Tac Toe")
#TitIco = pygame.image.load()
#pygame.display.set_icon()
# Main Game Loop
RunNow = True
while RunNow:
for event in pygame.event.get():
win.fill((240 , 240 , 240 ))
pygame.draw.rect(win, Blackk, pygame.Rect(150, 0, 20, 500))
pygame.draw.rect(win, Blackk, pygame.Rect(335, 0, 20, 500))
pygame.draw.rect(win, Blackk, pygame.Rect(0, 150, 500, 20))
pygame.draw.rect(win, Blackk, pygame.Rect(0, 335, 500, 20))
win.blit(You_R, textRect)
if event.type == pygame.QUIT:
RunNow = False
pygame.display.update()
Aucun commentaire:
Enregistrer un commentaire