Draws a responsive game border and a header area for the scoreboard and controls.
(self)
| 10 | self.create_wall() |
| 11 | |
| 12 | def create_wall(self): |
| 13 | """Draws a responsive game border and a header area for the scoreboard and controls.""" |
| 14 | width = self.screen.window_width() |
| 15 | height = self.screen.window_height() |
| 16 | |
| 17 | # Calculate coordinates for the border based on screen size |
| 18 | top = height / 2 |
| 19 | bottom = -height / 2 |
| 20 | left = -width / 2 |
| 21 | right = width / 2 |
| 22 | |
| 23 | wall = Turtle() |
| 24 | wall.hideturtle() |
| 25 | wall.speed("fastest") |
| 26 | wall.color(colors.WALL_COLOR) |
| 27 | wall.penup() |
| 28 | |
| 29 | # Draw the main rectangular border |
| 30 | wall.goto(left + 10, top - 10) |
| 31 | wall.pendown() |
| 32 | wall.pensize(10) |
| 33 | wall.goto(right - 10, top - 10) |
| 34 | wall.goto(right - 10, bottom + 10) |
| 35 | wall.goto(left + 10, bottom + 10) |
| 36 | wall.goto(left + 10, top - 10) |
| 37 | |
| 38 | # Draw a line to create a separate header section for the score and buttons |
| 39 | wall.penup() |
| 40 | wall.goto(left + 10, top - 70) |
| 41 | wall.pendown() |
| 42 | wall.pensize(5) |
| 43 | wall.goto(right - 10, top - 70) |
| 44 | |
| 45 | self.screen.update() |
| 46 |