Dec-22-2020, 07:44 AM
(Dec-22-2020, 07:28 AM)buss0140 Wrote:(Dec-22-2020, 03:57 AM)bowlofred Wrote: That's an odd error. That value should be set within the turtle library. Do you have the ability to try another python distribution? It looks more like a problem with the turtle library than with your code...
I have been using repl.it but I have tried on IDLE using distro 3.8.5 and 3.9.1 with the same result.
I switched it to this now:
import turtle
import random
import math
class Ball(turtle.Turtle):
def __init__(self, x, y, x_vel, y_vel):
turtle.Turtle.__init__(self)
self.x = x
self.y = y
self.vx = x_vel
self.vy = y_vel
self.penup()
self.speed(0)
self.setpos(x, y)
class Paddle:
def __init__(self, x, y):
Ball.__init__(self, x, y)
class LeftPaddle(Paddle):
def __init__(self, x=5, y=500):
Paddle.__init__(self, x, y)
class RightPaddle(Paddle):
def __init__(self, x=995, y=500):
Paddle.__init__(self, x, y)
But I am getting this error now.
Traceback (most recent call last):
File "main.py", line 289, in <module>
Game()
File "main.py", line 253, in __init__
self.left_paddle = LeftPaddle()
File "main.py", line 238, in __init__
Paddle.__init__(self, x, y)
File "main.py", line 234, in __init__
Ball.__init__(self, x, y)
TypeError: __init__() missing 2 required positional arguments: 'x_vel' and 'y_vel'
I am not sure why it wants the other two arguments when I am only inheriting two of the four parameters from class Ball.