When ever I try to run my code I constantly get this error:
RuntimeError: maximum recursion depth exceeded while calling a Python object
I am quite confused to why this happens, I am trying to make a picture blit and constantly move down the screen, as an object that the player has to dodge and if hits gets "killed" (Still to add collisions in). When I start to get the error is spams the shell with this:
File "C:\Users\John\Desktop\Michael\V'Room External\GAME_MAIN_.py", line 195, in movement
fallingObject()
File "C:\Users\John\Desktop\Michael\V'Room External\GAME_MAIN_.py", line 206, in fallingObject
movement()
File "C:\Users\John\Desktop\Michael\V'Room External\GAME_MAIN_.py", line 160, in movement
print(x)
File "C:\Python34\lib\idlelib\PyShell.py", line 1352, in write
return self.shell.write(s, self.tags)
RuntimeError: maximum recursion depth exceeded while calling a Python object
The relevant code is:
def movement():
crashed = False
while not crashed:
print(x)
...
if x < -10:
x = -10
else:
if x > 490:
x = 490
else:
fallingObject()
def fallingObject():
global w
w = 20
global o_x
o_x = random.randrange(0,width)
objectSpawn = True
while objectSpawn:
movement()
...