Files
python_bootcamp/023/player.py
2025-07-16 14:17:51 +02:00

27 lines
659 B
Python

from turtle import Turtle
class Player(Turtle):
STARTING_POSITION = (0, -280)
MOVE_DISTANCE = 10
FINISH_LINE_Y = 280
def __init__(self):
super().__init__()
self.shape("turtle")
self.color("black")
self.pu()
self.setheading(90)
self.goto(self.STARTING_POSITION)
def move_up(self):
self.goto(x=self.xcor(), y=self.ycor() + self.MOVE_DISTANCE)
print(self.ycor())
def has_won(self):
if self.ycor() >= self.FINISH_LINE_Y:
return True
return False
def reset_position(self):
self.clear()
self.goto(self.STARTING_POSITION)