Sign in to follow this  
Smit

Handling different game modes?

Recommended Posts

I’ve finished my basic pong clone but now I want to add some variation and add separate “gamemodes” it. So there would be basic pong, pong with power ups and whatever else I mange to think of. What I’m trying to decide what is a good way of handling all of these different modes. I could use a big switch statement or I could even load each from a dll and have each one respond to one Update() function (as I plan on having the actual engine is separate from the “game”), How do these sound or do you know of a better solution? Thanks!”

Share this post


Link to post
Share on other sites
Well, this refers to the term of "game state".
Just think about having a game loop for each game state, and switching game states becomes simply ending one loop and starting up another.

This can be done in several ways, like with function pointers, derived classes, a decorator pattern...

Share this post


Link to post
Share on other sites

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

Sign in to follow this