# check if its a valid location then drop a piece # turn decision, if black(1)/white(2) piece already placed, go back to the previous turn Label_2 = my_font.render('White wins!', True, WHITE, BLACK)Įlif event.type = pygame.MOUSEBUTTONDOWN: Label_1 = my_font.render('Black wins!', True, WHITE, BLACK) Turn = 0 # turn = 0 for player 1, turn = 1 for player 2īoard = create_board(ROW_COUNT,COL_COUNT) # check for negatively sloped diagonal win # check for positively sloped diagonal wih If board = piece and board = piece and board = piece and board = piece\ (screen, BLACK, line_start,line_end,2)įor y in range(BLOCKSIZE // 2, S_HEIGHT - BLOCKSIZE // 2 BLOCKSIZE, BLOCKSIZE):Ĭircle_pos = (x * BLOCKSIZE BLOCKSIZE//2, y * BLOCKSIZE BLOCKSIZE//2) Rect = pygame.Rect(x, y, BLOCKSIZE, BLOCKSIZE)įor x in range(BLOCKSIZE // 2, S_WIDTH - BLOCKSIZE // 2 BLOCKSIZE, BLOCKSIZE): SCREENSIZE = (S_WIDTH PADDING_RIGHT,S_HEIGHT) S_HEIGHT = ROW_COUNT * BLOCKSIZE # screen height S_WIDTH = COL_COUNT * BLOCKSIZE # screen width So far, the basic features are working fine with 2 players going against each other. I attempted to implement a simple Gomoku game (connect 5) in pygame and wanted to get some help.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |