O'Reilly logo

Software Engineering and Computer Games by Rudy Rucker

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

13.3. The cCritterBullet

As mentioned in the last section, when a cCritterArmed fires a shot, its shoot method is called, and a new bullet gets initialized in two stages. First the bullet’s no-argument constructor cBullet() is called. The constructor does the following.

  • Sets the bullet’s _collidepriority to the relatively high value cCollider::CP_BULLET. Since this value is higher than cCollider::CP_CRITTER, this means that when a bullet hits a normal critter, the bullet invokes the collide method as the caller instead of as the argument.

  • Tells the bullet to have a limited lifetime by setting _usefixedlifetime to TRUE and setting the size of _fixedlifetime to cCritterBullet::FIXEDLIFETIME, which happens to be set to 3.0 seconds. (Note that you ...

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