-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathturtle_writer.py
More file actions
28 lines (21 loc) · 851 Bytes
/
turtle_writer.py
File metadata and controls
28 lines (21 loc) · 851 Bytes
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
from turtle import Turtle
class Turtle_Writer(Turtle):
def __init__(self):
super().__init__()
self.hideturtle()
self.penup()
self.color('Red')
self.speed('fastest')
self.goto(0,280)
self.score = 0
self.write(arg= f'Your score: {self.score}', align= 'center', font= ('Arial', 12, 'normal'))
def writer_refresh(self):
self.clear()
self.score += 1
self.write(arg= f'Your score: {self.score}', align= 'center', font= ('Arial', 12, 'normal'))
def game_over(self):
self.goto(0,0)
self.write(arg= f'GAME OVER...', align= 'center', font= ('Arial', 12, 'normal'))
def reset_game(self):
self.goto(0,0)
self.write(arg= f'Press Space to Reset.', align= 'center', font= ('Arial', 12, 'normal'))