Chapter 7. Platformer – Guns, Life, Money, and the Enemy
In this chapter, we will do many things. First, we will build a machine gun with a variable rate of fire and have it shoot bullets. Then, we will introduce pickups or collectibles. These give the player something to scavenge for while trying to escape into the next level.
Then, just as Bob was beginning to think that his life was a blissful one of grass and collectibles, we will build two adversaries for him to outsmart or kill. A homing drone and a patrolling guard. We will easily be able to add all these things into our level designs.
Ready aim fire
Now, we can give our hero a gun, and later, we can give him enemies to shoot at. We will create a MachineGun
class to do all the work and a ...
Get Android Game Programming by Example 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.