0

while wrtiing chess engine , i am using blit for drawing the pieces on the board. the problem is that it looks very bad , a black rectangle is created and added to the icons of the pieces . it looks like that:

http://i58.tinypic.com/n1fbzc.jpg

but i want it to look like this:

http://i62.tinypic.com/4zutfo.jpg

here is the code, the first 2 lines is example for one piece, and the rest(the "for") is for drawing all of them:

    white_queen = pygame.image.load(os.path.join("images","wQn.png")).convert()
    self.icons['wQ'] = pygame.transform.scale(white_queen, (self.square_size,self.square_size))

    for r in range(boardSize):
        for c in range(boardSize):
            print "r is " + str(r) + ", and c is " + str(c)
            (screenX,screenY) = self.ConvertToScreenCoords((r,c))
            piece_name = board[r][c]
            print "screen x is " + str(screenX) + ", and y is " + str(screenY)
            print "name is " + piece_name
            if piece_name != 'e':
                self.screen.blit(self.icons[piece_name],(screenX,screenY), special_flags = BLEND_RGBA_MULT)

    pygame.display.flip()

i guess that i am missing some parameter in calling to blit , or to call another function..

tahnks for your help.

4

0 回答 0