Game Development Reference
In-Depth Information
Chapter 16
Gameplay Programming
16.1 Introduction
In this section we are going to look into the gameplay programming of the Jewel
Jam game. First, we will talk about interaction between game objects. Then, we
will introduce a few new game objects that are used in the game. Finally, we will
tackle the main gameplay element of this game: finding combinations of jewels and
properly handling them.
16.2 Interaction Between Game Objects
16.2.1 Finding Other Game Objects
In the previous chapter, we have presented the game world as a list of game objects.
Each of these game objects may process user input, and may exhibit some kind of
behavior. For example, the row selector game object checks if the player has pressed
any of the arrow keys, and it moves to another row, or it performs a row shifting
operation on the playing grid. This is a typical example of how many game objects
in games will be designed. They process input from the player, and they react to it,
either by doing something themselves (move to another row), or by influencing other
game objects (shift a row in the grid). In the Painter game, we saw that the ball and
the paint cans interacted with each other in a similar fashion. In more complicated
games, many different game objects will interact with each other.
The problem is: how do these game objects find each other? In the case of the
Painter game, the GameWorld class had a specific property for retrieving the Ball ob-
ject. This is not a very good solution, since it makes the GameWorld class completely
dependent on the game that it is a part of. However, in the JewelJamGameWorld we
onlyhavealistof GameObject s, which makes it much more complicated to find a
particular game object.
 
Search WWH ::




Custom Search