day 22 (actually, there's no 21) - finished Pong

This commit is contained in:
Tanguy Deleplanque
2025-07-16 12:47:31 +02:00
parent 670508261b
commit 697d53f836
5 changed files with 52 additions and 9 deletions

18
022/score.py Normal file
View File

@ -0,0 +1,18 @@
from turtle import Turtle
class Score(Turtle):
def __init__(self, x_pos):
super().__init__()
self.score = 0
self.color("white")
self.hideturtle()
self.pu()
self.goto(x=x_pos, y=270)
self.write(self.score, move=False, align='center', font=('Arial', 24, 'normal'))
def increment(self):
self.score += 1
def update(self):
self.clear()
self.write(self.score, move=False, align='center', font=('Arial', 24, 'normal'))