Questions tagged [skscene]

An SKScene object represents a scene of content in Sprite Kit. A scene is the root node in a tree of Sprite Kit nodes (SKNode). These nodes provide content that the scene animates and renders for display. To display a scene, you present it from an SKView object. SKScene is Apple technology for use on iOS 7.0 and later.

An SKScene object represents a scene of content in Sprite Kit. A scene is the root node in a tree of Sprite Kit nodes (SKNode). These nodes provide content that the scene animates and renders for display. To display a scene, you present it from an SKView object.

A scene calculates the contents of a new frame by processing the following actions in order:

  • The scene calls its update: method.
  • The scene executes actions on its children.
  • The scene calls its didEvaluateActions method.
  • The scene executes any physics simulations on physics bodies in the scene.
  • The scene calls its didSimulatePhysics method.

Click Here for Apple's Documentation Reference for SKScene.

653 questions
4
votes
1 answer

Reset scene in SpriteKit

I have two different view controllers with a SKScene in the first one. There we find the game itself and in the second one the score with a "Replay" button. When the game finishes, I delete the scene and I allocand init it again when the user clicks…
IOS_DEV
  • 949
  • 3
  • 12
  • 33
4
votes
1 answer

Where is the right place to configure SKScene content in SpriteKit?

Is it ok to configure (position sprites, add visible nodes etc) an SKScene's content in init method? Where is the right place for such things: init? didMoveToView? something else?
AndrewShmig
  • 4,843
  • 6
  • 39
  • 68
4
votes
6 answers

Delay when calling SKLabelNode?

I am having a problem with a slight delay (lag) when transitioning from one SKScene to another. By commenting out various bit of code I have narrowed this down to SKLabelNode, my guess is thats its loading / caching the font when called which is…
fuzzygoat
  • 26,573
  • 48
  • 165
  • 294
3
votes
1 answer

SKView.presentScene with transition not working if have shown another SKView

Update - see my own answer, it was a retain cycle with very indirect results. I have a very weird bug apparently as some kind of side-effect of having shown an SKView in a different UIView. It seems a manifestation of the old iOS9 bug presentScene…
Andy Dent
  • 17,578
  • 6
  • 88
  • 115
3
votes
0 answers

Is there an efficient way to auto populate a tile map with physics bodies?

I'm basically painting the world in the native tile mapper and then placing sprite nodes everywhere to act as physics bodies for it. Since tile maps are based on rounded whole number coordinates (x: 1, y: 1) and the scene editor has three decimal…
genericguy25
  • 602
  • 3
  • 16
3
votes
2 answers

Fast-paced SpriteKit game has irregular CPU activity and is jittery/lags despite frame rate staying high - Swift

I'm having the issue on a simple but fast-paced SpriteKit game, but I've reduced my code just to a bouncing ball and still get the issue to a lesser extent: override func didMove(to view: SKView) { super.didMove(to: view) …
SuperCodeBrah
  • 2,874
  • 2
  • 19
  • 33
3
votes
1 answer

SpriteKit: callback when scene is done presenting?

In SpriteKit, is there a callback when a scene has completed its transition? It doesn't appear like the SKView presentScene function has a callback. The alternative is to have the scene manually notify the caller after the scene moves into view, but…
Crashalot
  • 33,605
  • 61
  • 269
  • 439
3
votes
0 answers

Add delay to SKEmitter or SKReference to Scene editor

I'm trying to sempificate some animation with scene kit. I want to achieve to have an SKEmitter to the scene after some delay. The SKEmitter has a limitated number of spawn emitter, so it is during just 1 second, but I want this animation after 2…
Simone Pistecchia
  • 2,746
  • 3
  • 18
  • 30
3
votes
2 answers

Are SpriteKit Scene (.sks) files necessary in my project?

I tried searching and couldn't find the answer. Is it necessary to have a matching .sks file for each of my scene files? If I delete my matching .sks files will there be a problem? I understand this file is kind of for interface building but I…
Brejuro
  • 3,421
  • 8
  • 34
  • 61
3
votes
1 answer

Create a Login Page for SKSprite Game

I am in the process of creating a game (Swift) in xcode using a number of SKScene and Sprite objects. I want to create a Scene (settings scene) that captures the player's name, email, gender etc. How can I go about this? How can I capture input from…
Nick
  • 555
  • 2
  • 4
  • 13
3
votes
4 answers

SpriteKit: suggestions for rounding corners of unconventional grid?

The goal is to round the corners of an unconventional grid similar to the…
Crashalot
  • 33,605
  • 61
  • 269
  • 439
3
votes
1 answer

How to use applicationWillTerminate for a specific SKScene?

I have an SKScene that displays the players that joined the current room. If any of those players leaves the room (by clicking on the Leave button) their players list will be updated. But if I close the app from one of the players, that specific…
Sorin
  • 43
  • 1
  • 5
3
votes
0 answers

How to use SKNode fileNamed: initializer on any node that is not an SKScene

I have asked this similar question a while ago, but since then it seems SKNode now has this nifty initializer init?(fileNamed filename: String) that unarchives the scene from an .sks file. The thing is, this initializer is on SKNode, not SKScene,…
mogelbuster
  • 1,066
  • 9
  • 19
3
votes
1 answer

Adding SKScene to UIViewController gives me errors

What I want An infinite background that randomly adds objects (in my cases little stars) to the middle of the screen. Then those objects needs to move out of the screen with a certain speed. This way I want to give the user the feeling they are…
Petravd1994
  • 893
  • 1
  • 8
  • 24
3
votes
1 answer

SceneKit: how to create chessboard pattern for SCNFloor from image?

The goal is to create an infinite chessboard pattern. Using a SCNFloor and the attached image, we produce something close but not quite like a chessboard. Some black squares merge where they shouldn't. We tried different values for Scale, WrapS,…
Crashalot
  • 33,605
  • 61
  • 269
  • 439