Game Development Reference
In-Depth Information
are automatically propagated to all the game objects in the hierarchy. Another nice
thing that we can now do because of this hierarchical structure is modify the position
of a parent object, and the child objects will automatically be moved accordingly.
For example, try to place the playingField object at another position:
playingField.Position = new Vector2(300, 100);
The result of this change is seen in Fig. 14.1 . As you can see, all the child objects
are nicely moved along, the row selection mechanism works just as well as the row
shifting operations. Here you see the true power of placing game objects in such a
hierarchy: we have a lot of control over how the objects are placed on the screen.
We could even go completely crazy and give the playing field object a velocity so
that it moves around the screen!
14.6 What You Have Learned
In this chapter, you have learned:
how to organize game objects in a scene graph;
how to create structured collections of game objects, such as a grid or a list;
what the difference is between local and global positions;
how to make the scene graph an integral part of the game by using it for drawing
and updating the game objects.
 
Search WWH ::




Custom Search