28 lines
568 B
Python
28 lines
568 B
Python
from turtle import Turtle
|
|
|
|
STARTING_POSITION = (0, -450)
|
|
MOVE_DISTANCE = 10
|
|
FINISH_LINE_Y = 490
|
|
|
|
|
|
class Player(Turtle):
|
|
def __init__(self):
|
|
super().__init__()
|
|
self.shape("turtle")
|
|
self.penup()
|
|
self.color("turquoise")
|
|
self.go_to_start()
|
|
self.setheading(90)
|
|
|
|
def go_up(self):
|
|
self.forward(MOVE_DISTANCE)
|
|
|
|
def go_to_start(self):
|
|
self.goto(STARTING_POSITION)
|
|
|
|
def is_at_finish_line(self):
|
|
if self.ycor() > FINISH_LINE_Y:
|
|
return True
|
|
else:
|
|
return False
|