File size: 573 Bytes
8f8cea6 | 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 | PADDLE_DISTANCE = 30
class Paddle(Turtle):
def __init__(self, coordinates):
super().__init__()
self.shape("square")
self.shapesize(stretch_len=PADDLE_SIZE)
self.color("white")
self.speed("fastest")
self.setheading(90)
self.penup()
self.goto(coordinates)
def up(self):
if self.ycor() > 240:
pass
else:
self.forward(PADDLE_DISTANCE)
def down(self):
if self.ycor() < -240:
pass
else:
self.backward(PADDLE_DISTANCE)
|