I am trying to make a basic Pong and I don't understand why the arrow/turtle in the middle of the screen displays.
The paddle on the screen consists of 6x turtle objects stored in self.paddle
.
I know the problem has something to do with the p = Paddle()
but I don't understand where the arrow-object is since it seems to not be in the list mentioned above (print(self.paddle)
).
Can someone enlighten me?
from turtle import Turtle, Screen
screen = Screen()
screen.setup(width=1000, height=700)
class Paddle(Turtle):
def __init__(self):
super().__init__()
self.paddle = []
self.create_player_paddle()
def create_player_paddle(self):
for pad in range(0, 6):
x = -480
y = 30
p = Turtle(shape="square")
p.turtlesize(0.5)
p.penup()
p.goto(x, y)
self.paddle.append(p)
for part in range(len(self.paddle)):
self.paddle[part].goto(x, y)
y -= 10
p = Paddle()
screen.update()
screen.exitonclick()