O'Reilly logo

CRYENGINE Game Development Blueprints by Sam Howels, Riham Toulan, Chris Goodswen, Richard Gerard Marcoux III

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

Creating an ammo class

Now that we have created our weapon system, it is time for us to create an ammunition system. Ammunition is what our weapons use to cause damage. It can be anything from a bullet to a magic spell, anything that results in damage caused by firing some weapon. Since we wish to achieve a modular and extensible design, we will accomplish this using interfaces once again.

Creating the IAmmo class

Since we need our game to support many ammunition types and we want to write clean, modular, OOP C++ code, it is essential that we create an ammo interface which we will call IAmmo. Let's do it:

  1. Create a new file called IAmmo.h that will hold our IAmmo interface declaration. It should look like this:
    #ifndef __IAMMO_HEADER__ #define __IAMMO_HEADER__ ...

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