I'm able to run the program and the screen pops up with the paddles and the ball, the paddles just wont go up and down, but i was able to get them to move previously before i started simplifying my code and i just cant seem to find where i made a mistake or if im missing something. Any help would be much appreciated. i attached my main.py file and my paddle.py file below. And thank you again for any help
main.py file
from turtle import Screen
from paddle import Paddle
from ball import Ball
import time
screen = Screen()
screen.bgcolor("black")
screen.setup(width=800, height=600)
screen.title("It's Pong")
screen.tracer(0)
r_paddle = Paddle((350, 0))
l_paddle = Paddle((-350, 0))
ball = Ball()
screen.listen()
screen.onkey(r_paddle.go_up(), "Up")
screen.onkey(r_paddle.go_down(), "Down")
screen.onkey(l_paddle.go_up(), "w")
screen.onkey(l_paddle.go_down(), "s")
game_is_on = True
while game_is_on:
time.sleep(0.1)
screen.update()
ball.move()
screen.exitonclick()
paddle.py file
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)