day 22 (actually, there's no 21) - finished Pong
This commit is contained in:
20
022/paddle.py
Normal file
20
022/paddle.py
Normal file
@ -0,0 +1,20 @@
|
||||
from turtle import Turtle
|
||||
|
||||
class Paddle(Turtle):
|
||||
def __init__(self, x_pos):
|
||||
super().__init__()
|
||||
|
||||
self.shape("square")
|
||||
self.shapesize(stretch_wid=5, stretch_len=1)
|
||||
self.color("white")
|
||||
self.pu()
|
||||
self.teleport(x=x_pos, y=0)
|
||||
|
||||
def reset_position(self, x_pos):
|
||||
self.teleport(x=x_pos, y=0)
|
||||
|
||||
def up(self):
|
||||
self.goto(x=self.xcor(), y=self.ycor()+20)
|
||||
|
||||
def down(self):
|
||||
self.goto(x=self.xcor(), y=self.ycor()-20)
|
||||
Reference in New Issue
Block a user