-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathplayer.py
33 lines (28 loc) · 857 Bytes
/
player.py
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
from turtle import Turtle
START_POSITION = (0, -280)
class Player(Turtle):
def __init__(self):
super().__init__()
self.color("black")
self.shape("turtle")
self.penup()
self.setheading(90)
self.shapesize(1)
self.goto_start()
def move_forward(self):
new_y_cor = self.ycor() + 16
self.goto(self.xcor(), new_y_cor)
#def move_back(self):
#new_y_cor = self.ycor() - 16
#self.goto(self.xcor(), new_y_cor),
#def move_left(self):
#new_x_cor = self.xcor() - 16
#self.goto(new_x_cor, self.ycor())
#def move_right(self):
#new_x_cor = self.xcor() + 16
#self.goto(new_x_cor, self.ycor())
def at_finish(self):
if self.ycor() > 280:
return True
def goto_start(self):
self.goto(START_POSITION)