-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathscoreboard.py
More file actions
48 lines (39 loc) · 1.27 KB
/
Copy pathscoreboard.py
File metadata and controls
48 lines (39 loc) · 1.27 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
from turtle import Turtle
class ScoreBoard(Turtle):
def __init__(self):
super().__init__()
self.score = 0
self.color("white")
self.penup()
self.hideturtle()
self.l_score = 0
self.r_score = 0
self.update_scoreboard()
def update_scoreboard(self):
self.clear()
self.goto(-100, 200)
self.write(arg=self.l_score, align="center", font=("Courier", 80, "normal"))
self.goto(100, 200)
self.write(arg=self.r_score, align="center", font=("Courier", 80, "normal"))
def l_point(self):
self.l_score += 1
self.update_scoreboard()
def r_point(self):
self.r_score += 1
self.update_scoreboard()
# Dosn't work
# def screen_divider(self):
# self.penup()
# self.hideturtle()
# self.pencolor("white")
# self.pensize(width=5)
# self.goto(0, 280)
# self.setheading(270)
# for i in range(13):
# self.penup()
# self.forward(20)
# self.pendown()
# self.forward(20)
# def game_over(self):
# self.goto(0, 0)
# self.write(arg="Game Over", align="center", font=("Arial", 30, "normal"))