O'Reilly logo

Android: Game Programming by Raul Portales, John Horton

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

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 ...

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