I'm trying to make it so that the script generates a random x position for a shape that will be created.
I am rather new to python so I have no idea how to fix this.
Code section: (inside of pygame game loop)
class falling_object():
def __init__(self):
pass
def create():
global random_x
random_x = random.randint(10, 470)
random_size = random.randint(20, 40)
pygame.draw.circle(screen, (255, 255, 0), random_x, falling_y, random_size, random_size) # error is here at the random_x and random_size part, falling_y is a variable equal to 0
Where the function is called:
obj1 = falling_object()
falling_object.create()