O'Reilly logo

Pro HTML5 Games by Aditya Ravi Shankar

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 9

image

Adding Weapons and Combat

Over the past few chapters, we built the basic framework for our game; added entities such as vehicles, aircraft, and buildings; implemented unit movement; and created a simple economy using the sidebar. We now have a game where we can start the level, earn money, purchase buildings and units, and move these units around to achieve simple goals.

In this chapter, we will implement weapons for vehicles, aircraft, and turrets. We will add the ability to process combat-based orders such as attacking, guarding, patrolling, and hunting to allow the units to fight in an intelligent way. Finally, we will implement ...

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