Use the Game Loop to Apply Game Logic

In SpriteKit, the game loop is handled with a series of frame-cycle events. These events, in the order in which they occur, are as follows:

  1. The update(_:) method is called. This method gets called once per every frame and is the main method you’ll use to execute your game logic.

  2. SKScene evaluates the actions. At this point, your scene processes all of the actions it needs to process.

  3. The didEvaluateActions() method is called. This method gets called after all of the actions for the frame are processed.

  4. SKScene simulates physics. At this point, your scene processes all of the physics on nodes with attached physics bodies.

  5. The didSimulatePhysics() method is called. This method gets called after all of the ...

Get Apple Game Frameworks and Technologies now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.