Skip to content

Commit f76f89e

Browse files
authored
Create scoreboard.py
1 parent 6bd4a6e commit f76f89e

File tree

1 file changed

+27
-0
lines changed

1 file changed

+27
-0
lines changed
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
from turtle import Turtle
2+
3+
4+
class Scoreboard(Turtle):
5+
6+
def __init__(self):
7+
super().__init__()
8+
self.score = 0
9+
self.color("white")
10+
self.penup()
11+
self.goto(0, 260)
12+
self.write(f"Score: {self.score}", align="center", font=("Arial",24,"normal"))
13+
self.hideturtle()
14+
self.update_scoreboard()
15+
16+
def update_scoreboard(self):
17+
self.write(f"Score: {self.score}", align="center", font=("Arial", 24, "normal"))
18+
19+
def game_over(self):
20+
self.goto(0,0)
21+
self.write("GAME OVER",align="center", font=("Arial", 24, "normal"))
22+
23+
24+
def increase_score(self):
25+
self.score += 1
26+
self.clear()
27+
self.update_scoreboard()

0 commit comments

Comments
 (0)