day 22 (actually, there's no 21) - finished Pong
This commit is contained in:
18
022/score.py
Normal file
18
022/score.py
Normal 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'))
|
||||
Reference in New Issue
Block a user