I have been working on a small game and I cannot understand why the following code does not run.
def mainMenu(font, windowSurface, x, y):
while True:
for event in pygame.event.get():
if event.type == KEYDOWN:
if event.key == K_ESCAPE:
terminate()
if event.key == K_RETURN:
selectTeam(font, windowSurface, x, y)
windowSurface.fill(BACKGROUNDCOLOUR)
drawText('text', titleFont, windowSurface, 235, 225)
drawText('text', setupFont, windowSurface, 400, 375)
drawText('text', subtitleFont, windowSurface, 0, 700)
pygame.display.update()
clock.tick(FPS)
mainMenu(font, windowSurface, x, y)
When this text is run, it comes up with:
NameError: name 'x' is not defined
The error occurs in the last line of code, which is calling the function. I was just wondering if there was more code I needed to add, or if I have completely messed it up?
Thanks :D