(tilesToFlip, tileColor, additionalTile)
| 225 | |
| 226 | |
| 227 | def animateTileChange(tilesToFlip, tileColor, additionalTile): |
| 228 | # Draw the additional tile that was just laid down. (Otherwise we'd |
| 229 | # have to completely redraw the board & the board info.) |
| 230 | if tileColor == WHITE_TILE: |
| 231 | additionalTileColor = WHITE |
| 232 | else: |
| 233 | additionalTileColor = BLACK |
| 234 | additionalTileX, additionalTileY = translateBoardToPixelCoord(additionalTile[0], additionalTile[1]) |
| 235 | pygame.draw.circle(DISPLAYSURF, additionalTileColor, (additionalTileX, additionalTileY), int(SPACESIZE / 2) - 4) |
| 236 | pygame.display.update() |
| 237 | |
| 238 | for rgbValues in range(0, 255, int(ANIMATIONSPEED * 2.55)): |
| 239 | if rgbValues > 255: |
| 240 | rgbValues = 255 |
| 241 | elif rgbValues < 0: |
| 242 | rgbValues = 0 |
| 243 | |
| 244 | if tileColor == WHITE_TILE: |
| 245 | color = tuple([rgbValues] * 3) # rgbValues goes from 0 to 255 |
| 246 | elif tileColor == BLACK_TILE: |
| 247 | color = tuple([255 - rgbValues] * 3) # rgbValues goes from 255 to 0 |
| 248 | |
| 249 | for x, y in tilesToFlip: |
| 250 | centerx, centery = translateBoardToPixelCoord(x, y) |
| 251 | pygame.draw.circle(DISPLAYSURF, color, (centerx, centery), int(SPACESIZE / 2) - 4) |
| 252 | pygame.display.update() |
| 253 | MAINCLOCK.tick(FPS) |
| 254 | checkForQuit() |
| 255 | |
| 256 | |
| 257 | def drawBoard(board): |
no test coverage detected