100-Days-Of-Code/PycharmProjects/Pong-Game/paddle.py
Arcron ArchLinux 8e5462f8db 100Days
2024-10-26 14:55:49 +05:30

21 lines
459 B
Python

from turtle import Turtle
class Paddle(Turtle):
def __init__(self, position):
super().__init__()
self.shape("square")
self.color("white")
self.shapesize(stretch_wid=5, stretch_len=1)
self.penup()
self.goto(position)
def go_up(self):
new_y = self.ycor() + 20
self.goto(self.xcor(), new_y)
def go_down(self):
new_y = self.ycor() - 20
self.goto(self.xcor(), new_y)