Made an epic showcase website and API!
This commit is contained in:
parent
9e21e4dbdd
commit
1907fad7c5
89 changed files with 36444 additions and 3 deletions
28
projects/Day 21/scoreboard.py
Normal file
28
projects/Day 21/scoreboard.py
Normal file
|
|
@ -0,0 +1,28 @@
|
|||
from turtle import Turtle
|
||||
|
||||
ALIGNMENT = "center"
|
||||
FONT = ("Open Sans", 16, "normal")
|
||||
|
||||
|
||||
class Scoreboard(Turtle):
|
||||
def __init__(self):
|
||||
super().__init__()
|
||||
self.score = 0
|
||||
self.penup()
|
||||
self.hideturtle()
|
||||
self.goto(x=0, y=260)
|
||||
self.color("white")
|
||||
self.update_scoreboard()
|
||||
|
||||
def update_scoreboard(self):
|
||||
self.write(f"Score: {self.score}", align=ALIGNMENT, font=FONT)
|
||||
|
||||
def increase_score(self):
|
||||
self.score += 1
|
||||
self.clear()
|
||||
self.update_scoreboard()
|
||||
|
||||
def game_over(self):
|
||||
self.goto(x=0, y=0)
|
||||
self.color("red")
|
||||
self.write("GAME OVER", align=ALIGNMENT, font=FONT)
|
||||
Loading…
Add table
Add a link
Reference in a new issue