MCPcopy Create free account
hub / github.com/asweigart/PythonStdioGames / drawBoxCovers

Function drawBoxCovers

src/gamesbyexample/pygame_games/memorypuzzle.py:209–220  ·  view source on GitHub ↗
(board, boxes, coverage)

Source from the content-addressed store, hash-verified

207
208
209def drawBoxCovers(board, boxes, coverage):
210 # Draws boxes being covered/revealed. "boxes" is a list
211 # of two-item lists, which have the x & y spot of the box.
212 for box in boxes:
213 left, top = leftTopCoordsOfBox(box[0], box[1])
214 pygame.draw.rect(DISPLAYSURF, BGCOLOR, (left, top, BOXSIZE, BOXSIZE))
215 shape, color = getShapeAndColor(board, box[0], box[1])
216 drawIcon(shape, color, box[0], box[1])
217 if coverage > 0: # only draw the cover if there is an coverage
218 pygame.draw.rect(DISPLAYSURF, BOXCOLOR, (left, top, coverage, BOXSIZE))
219 pygame.display.update()
220 FPSCLOCK.tick(FPS)
221
222
223def revealBoxesAnimation(board, boxesToReveal):

Callers 2

revealBoxesAnimationFunction · 0.85
coverBoxesAnimationFunction · 0.85

Calls 3

leftTopCoordsOfBoxFunction · 0.85
getShapeAndColorFunction · 0.85
drawIconFunction · 0.85

Tested by

no test coverage detected