Creating an advanced game using design patterns
After understanding the basic design patterns, it's important to combine them to create a good game. It takes years of practice to finally understand what architecture will suit the game structure. More often than not, we have to use a few design patterns in conjunction to come up with clean code that can be applied to the game. The factory pattern will probably be your most used design pattern, but that is purely an anecdotal reference from my experience.
Getting ready
For this recipe, you will need a Windows machine with a working copy of Visual Studio.
How to do it…
In this recipe we will find out how easy it is to combine design patterns to create a game:
Open Visual Studio.
Create a new C++ project console application.
Add the following lines of code:
#ifndef _ISPEED_H #define _SPEED_H class ISpeed { public: virtual void speed() = 0; }; #end #ifndef _ISPECIALPOWER #define _ISPECIALPOWER class ISpecialPower { public: virtual void power...