Draw the lawn mower with its left edge at mowerx, mowery.
(mowerx, mowery, direction)
| 111 | |
| 112 | |
| 113 | def drawMower(mowerx, mowery, direction): |
| 114 | """Draw the lawn mower with its left edge at mowerx, mowery.""" |
| 115 | bext.fg('red') |
| 116 | if direction == 'right': |
| 117 | mowerText = MOWER_RIGHT |
| 118 | elif direction == 'left': |
| 119 | mowerText = MOWER_LEFT |
| 120 | |
| 121 | for i in range(MOWER_LEN): |
| 122 | if 0 <= mowerx + i < WIDTH: |
| 123 | bext.goto(mowerx + i, mowery) |
| 124 | print(mowerText[i], end='') |
| 125 | bext.goto(0, 0) # It looks better to move the cursor away. |
| 126 | |
| 127 | |
| 128 | # If this program was run (instead of imported), run the game: |