CHAPTER 6

image

Adding Entities to Our World

In the previous chapter, we put together the basic framework for our RTS game. We loaded a level and panned around using the mouse.

In this chapter, we will build upon that by adding entities to our game world. We will build a general framework that will allow us to easily add entities such as buildings and units to a level. Finally, we will add the ability for the player to select these entities using the mouse.

Let’s get started. We will use the code from Chapter 5 as our starting point.

Defining Entities

These are the game entities we will be adding to our game:

  • Buildings: Our game will have four types ...

Get Pro HTML5 Games now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.