Game Development Reference
In-Depth Information
In this section, I will describe what happens after the SKScene is presented by the
SKView . In a more traditional iOS application, you would render the view's content only
once, and it would stay static until the model that the view is presenting changes. This is
fine for a business app, but a game has the potential to constantly change.
Because of this dynamic characteristic, Sprite Kit is constantly updating the scene and its
contents. This constant updating is called the rendering loop (see Figure 2-1 ).
Figure 2-1 . The Sprite Kit rendering loop
Each iteration of this loop generates the next frame in the scene. The steps involved in
generating the next frame of a scene are as follows:
1.
The scene calls its update() method. This is where you will have most of
your game logic. More often than not, you will be moving nodes around,
adding new actions to existing nodes, and handling user input. (I will talk
about the update() method in Chapter 4 . )
2.
The scene next performs all programmed actions on its children. In this step,
the scene will execute any actions you may have set up in step 1. (I will talk
about actions in Chapter 5 . )
3.
The scene then calls the didEvaluateActions() method. This is
where you would put any post-action game logic. An example would be test-
Search WWH ::




Custom Search