text: So I am working on a game of breakout (you know, the game with the paddle where you have to break all of the bricks above with a ball that ends the game if it touches the bottom of the screen), just for fun. How do I make a menu? I have a vague idea that looks like this:
  def playGame(wallOfBlocks, ball, paddle):
  - def menu:
  - start_game = False
  - print('Press the spacebar to start')
  - keystate = pygame.key.get_pressed()
  - if pygame.key.get_pressed()[pygame.K_SPACE]:
  - start_game = True
  - gameOver = False
  - while not gameOver:
  - drawtotal_score()
  - drawNUMBER_OF_LIVES()
  - for block in wallOfBlocks:
  - checkBallHitBlock(ball, block)
  - if not block.isBusted:
  - block.draw()
  - for event in pygame.event.get():
  - if event.type == pygame.QUIT:
  - sys.exit()
  - ball.erase()
  - ball.move()
  - ball.draw()
  - keystate = pygame.key.get_pressed()
  - if keystate[pygame.K_ESCAPE]:
  - sys.exit()
  - paddle.erase()
  - if keystate[pygame.K_RIGHT]:
  - paddle.moveRight()
  - if keystate[pygame.K_LEFT]:
  - paddle.moveLeft()
  - paddle.draw()
  - checkBallHitPaddle(ball, paddle)
  - if (ball.y > WINDOW_SIZE_Y):
  - drawGameOver()
  - gameOver = True
  - pygame.display.update()
  - fpsClock.tick(FPS)
  What I'm really looking at is the underlined part. I have a fully functioning version of breakout, but it starts up immediately after running. Which is a problem because the window is in all sorts of odd places. So I want to give users the time to adjust the window. Every other part works just fine, but when I try to run the game with the underlined section of code, I get the following error:
  C:/Python26/pythonw.exe -u "J:/Folder/menu breakout.py"
  File "J:/Folder/menu breakout.py", line 198
  def menu:
  ^
  SyntaxError: invalid syntax