1234567891011121314151617181920212223 |
- from turtle import Turtle
- from config import SCREEN_HEIGHT
- class ScoreScreen(Turtle):
- def __init__(self):
- super().__init__()
- self.score = 0
- self.color('white')
- self.penup()
- self.hideturtle()
- self.goto(0, SCREEN_HEIGHT / 2 - 30)
- self.write("Score: 0", True, align="center", font=("Arial", 12, "normal"))
- def increase(self, ball):
- self.clear()
- self.goto(0, SCREEN_HEIGHT / 2 - 30)
- self.score += 1
- self.write(f"Score: {self.score}", True, align="center", font=("Arial", 12, "normal"))
- if self.score % 5 == 0: ball.speed_up()
-
- def reset(self):
- self.score = 0
-
|