O'Reilly logo

3D Game Programming for Teens, Second Edition by Eric Grebler, Maneesh Sethi

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Pausing the Game

If the player needs to take a break, he can always pause the game by pressing the letter P. When the letter P is pressed, a new image will appear on the screen, informing the player that he can press the mouse button to resume the game. Add the following code in bold to create the pause code:

For q=0 To maxbull
      MoveEntity bullet(q), 0,0.8,3
      Next
;Pausing the game
If KeyDown(P_KEY) Then
      Cls
      pause=LoadImage ("pause.bmp")
      DrawImage pause,0,0
      Flip
      WaitMouse()
EndIf

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required