15.2. The Defender3D code
cGameDefender3D
The overrides for cGameDefender3D are fairly routine. In the constructor, we have _border.set(19, 19.0, 41.0) to give the world a z-thickness. We think of the z direction as running down into the screen. We give the game a cCritterDefender3DPlayer, and the seedCritters calls a simple loop to populate the world.
for (int i=0; i < _seedcount; i++) new cCritterDefender3DProp(this);
The adjustGameParameters code is also quite simple; if there are less than _seedcount props, it replenishes the count.
In order to have our games behave smoothly as we use the menu to switch on and off the various View menu options, we need to have two separate view and viewer initialization methods. If we were only writing ...
Get Software Engineering and Computer Games now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.