A video game is composed of three primary components. The first is a visual element; we've already started working on that part. The second is user interaction and that is what we'll cover in the next chapter. Right now, we're going to start work on the third element dynamism. Video games change over time, whether it's the movement of objects on the screen, the rise or fall of statistics like health or ammo, or any number of other dynamic elements. Some of these changes occur at irregular times, but others require ongoing management. That ongoing management is the focus of this chapter.
This is what we'll talk about:
Tasks are used extensively in Panda3D applications and are a very important in controlling what happens in our game, so let's learn all about them together.
We can't talk about tasks without talking about the task manager. DirectStart
creates the task manager for us when it's imported, just like the loader
. The purpose of the task manager is to act as a keeper for all the tasks that have been created. Every frame the task manager executes each of the tasks; it's been given in sequential order. Once one task is finished, the task manager moves on to the next.