screenScore.py 681 B

1234567891011121314151617181920212223
  1. from turtle import Turtle
  2. from config import SCREEN_HEIGHT
  3. class ScoreScreen(Turtle):
  4. def __init__(self):
  5. super().__init__()
  6. self.score = 0
  7. self.color('white')
  8. self.penup()
  9. self.hideturtle()
  10. self.goto(0, SCREEN_HEIGHT / 2 - 30)
  11. self.write("Score: 0", True, align="center", font=("Arial", 12, "normal"))
  12. def increase(self, ball):
  13. self.clear()
  14. self.goto(0, SCREEN_HEIGHT / 2 - 30)
  15. self.score += 1
  16. self.write(f"Score: {self.score}", True, align="center", font=("Arial", 12, "normal"))
  17. if self.score % 5 == 0: ball.speed_up()
  18. def reset(self):
  19. self.score = 0