14.3. The Worms game

The Worms game isn’t so much a game as it is a wacky-world testing ground for a bunch of tricks.

The most obvious new wrinkle is that, we have ‘worms’ that are made up by linking together cCritterWormSegment objects with cForceObjectSpringRod forces.

Another visually striking feature is that we’re using a cSpriteLoop for the player’s sprite; this means that the sprite changes appearance every third of a second. If you comment out the line #define PLAYERSPRITELOOP at the start of the gameworms.cpp file and recompile, the player sprite will now use a cSpriteDirectional that changes its color to match the direction it’s pointing in.

The Worms code does some other things. The cCritterWormsRivalBullet objects run away from the ...

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.