In each frame, we update our world with all the entities inside. During an update, the whole game logic is computed: entities move and interact with each other, collisions are checked, and missiles are launched. Updating changes the state of our world and makes it progress over time, while rendering can be imagined as a snapshot of a part of the world at a given time point.
We can reuse our scene graph to reach all entities with our world updates. To achieve this, we implement a public
update() member function in the
SceneNode class. Analogous to the way we have proceeded for the
draw() function, we split up
update() into two parts: an update for the current node, and one for the child nodes. We thus write two private methods ...