Jump to content
  • Advertisement
Sign in to follow this  
  • entries
    5
  • comments
    2
  • views
    403

Pong - Adding Game Modes

rileyman

634 views

Part 2 of the Pong game development video series is over on my Youtube channel:

 

I'm reasonably satisfied with the refactoring pass.  I considered moving initialization of the window into the "GameClient" class as well, but wasn't sure how that would play with FreeGlut's use of callback functions.

In the meantime, I've been making my way through adding the game states:

  • Adding a "Press ENTER to Start" screen.
  • Ability to pause.
  • Adding a "Match Won" screen after a player reaches 10 points.

The only thing worth noting while working on these items is related to keyboard input.  Prior to this, I'd just been using the GetAsyncKeyState function, which is a Windows-specific function.  It's useful if all you want to know is whether a particular key is currently being pressed down.  The documentation warns against using it to tell if the key has been pressed since the last time the function was called, as it's not local to the currently-running application or window.

I hadn't used FreeGlut prior to this, so I was curious if it had its own keyboard functionality.  Lo and behold, you can set up callback functions with glutKeyboardFunc and glutSpecialFunc.  So I'll be using those for toggling between the Pause screen.

After I've done the game states, I'll start adding some game options:

  • Paddle size
  • Ball speed
  • Computer-controlled paddles

I'll be keeping track of my progress as I go using the Issues feature over on my GitHub account!

I do really hope to be done with Pong by the end of next weekend, as I've been brainstorming a ton about my next mini-project... ;)



0 Comments


Recommended Comments

There are no comments to display.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!