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:
-
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.
-
SKScene evaluates the actions. At this point, your scene processes all of the actions it needs to process.
-
The didEvaluateActions() method is called. This method gets called after all of the actions for the frame are processed.
-
SKScene simulates physics. At this point, your scene processes all of the physics on nodes with attached physics bodies.
-
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.