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
5
votes
1 answer

dismiss SKScene go back to UIKit Menu

Once my SpriteKit game has ended, I would like to go back to my UIKit MenuViewController. From what I've learned so far, using protocol/delegate is the best(?) option, but I haven't been able to get that to work. I know that the protocol would…
squarehippo10
  • 1,855
  • 1
  • 15
  • 45
5
votes
2 answers

Swift 3 (SpriteKit): Reseting the GameScene after the game ends

I am wanting to 'reset' and 'restart' the GameScene so it is as if the GameScene was first called. I have looked at different methods for doing this, but each time I get a warning that I'm trying to add a node to a parent which already has a parent.…
J.Treutlein
  • 963
  • 8
  • 23
5
votes
2 answers

How to determine if an ScnNode is left or right of the view direction of a camera node in SceneKit

I have a camera in the center of SceneKit scene at position(0,0,0) I'm rotation the camera around the y-axis to show different parts of the scene. I want to show arrows at the left/right side of my screen to show in which direction the user has to…
Stefan
  • 5,203
  • 8
  • 27
  • 51
5
votes
2 answers

Add SKReferenceNode/SKScene to another SKScene in SpriteKit

I would like to add a SKScene to my main GameScene. SKReferenceNode seems to be a good solution. I have : - GameScene.sks (main scene) - Countdown.sks (scene to add to GameScene) - Countdown.swift (Custom class, how does to init it? SKScene ?…
cmii
  • 3,556
  • 8
  • 38
  • 69
5
votes
4 answers

Add SKReferenceNode programmatically

I have long 2d level so I split it into more .sks files. I have "GameScene" where I can join them in Scene editor with drag and drop. It creates SKReferenceNodes. I've done that with success. But I would like to load these parts lazily when it's…
jendan
  • 271
  • 4
  • 14
5
votes
2 answers

Adding an SKScene to a UIViewController?

I just created a new UIViewController in interface builder. It is segued to from a UITableViewController (cell). I now want to work with an SKScene inside this UIViewController. How is this accomplished? And for a side-note... If the SKScene takes…
Yonny
  • 404
  • 7
  • 14
5
votes
3 answers

SKScene Fails to deallocate memory resulting in bounded memory growth

I have been struggling with this for days, for some reason my SKScenes are not deallocating correctly, this results in bounded memory growth as each time i exit and enter a scene the memory jumps up. This means after say 10 rounds of the game the…
SmokersCough
  • 967
  • 7
  • 22
5
votes
2 answers

SpriteKit scene transition good practices

I am writing a game using SpriteKit with Swift and have run into a memory concern. The layout of my game is such that the GameViewController (UIViewController) presents the first SKScene (levelChooserScene) in the viewDidLoad Screen. This scene…
Scooter
  • 4,068
  • 4
  • 32
  • 47
5
votes
1 answer

How do you get the "current system time"?

The documentation of SKScene -update is as follows: What exactly is "the current system time," and how can I get it other than via SKScene -update? I've tried CFAbsoluteTimeGetCurrent(), but apparently that Returns the current system absolute…
Michael Dorst
  • 8,210
  • 11
  • 44
  • 71
5
votes
1 answer

Presenting a scene in SpriteKit without discarding the previous?

My situation is that I have a GameMenuScene and after the user chooses a level, I want to present the LevelScene. But I do not want to have the previous GameMenuScene discarded because the LevelScene is actually a @property of GameMenuScene and…
aanrv
  • 2,159
  • 5
  • 25
  • 37
5
votes
1 answer

How do you add a CIPixellate Core Image Filter to a Sprite Kit scene?

How do you add a CIPixellate Core Image Filter to a Sprite Kit scene? I have a SpriteKit scene that is an SKScene or subclass of it. I want to add a Core Image filter to the scene. Specifically a CIPixellate filter, so I can have 8-bit game heaven…
uchuugaka
  • 12,679
  • 6
  • 37
  • 55
5
votes
4 answers

iOS7 SKScene how to make a sprite bounce off the edge of the screen?

I'm building a game with balls bouncing within the iPad's screen. Similar to a Pong game. I see that SKScene's SKPhysicsWorld has gravity property, and also controls how objects collide with each other. Is there some way I can automatically detect…
Alex Stone
  • 46,408
  • 55
  • 231
  • 407
4
votes
1 answer

SpriteKit: sprite looks blurry (with ghosting) at high velocity but fine at low velocity

When using high velocity (linear or angular) in SpriteKit, sprites look blurry as if there are "ghosts" trailing the sprite. The sprite looks fine at slow speeds. Below is a screenshot and GIF illustrating the blurriness/ghosting problem with high…
Crashalot
  • 33,605
  • 61
  • 269
  • 439
4
votes
1 answer

Use of an Audio Clip Causing Memory Leak

I have a sprite-kit game scene (SKScene) that uses audio clips from time to time. I don't want to create a new action (SKAction) every time I need to run a short audio clip since the sound could stutter. So I initialize an action variable with a…
El Tomato
  • 6,479
  • 6
  • 46
  • 75
4
votes
1 answer

Error with going back to a previous view in swift 3 Spritkit

When I switch to my gamescene from my menu scene, it works perfectly fine. But, when I try to go back, it is a disaster. I get: unexpectedly found nil while unwrapping an Optional value. The code for going back is: let menuscene = MenuScene(size:…
Peter
  • 87
  • 7
1 2
3
43 44