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

Position of mouse click relative to scene, not window

In my game I need to use the mouse to select units. However, I am encountering problems as I do not know how to get the coordinates of the click relative to the game, not to the window. For example, if Unit 1 is at the (0,0) point of the game, it…
Student-LTB
  • 103
  • 8
4
votes
3 answers

Swift: Using switch statement in touchesBegan

I want to clean up my touchesBegan(..) in SKScene. I wanted to make a case statement instead of my if .. else chain. However, I get errors when implementing, which suggests that I don't know how equality is done under the hood. Before…
cdpalmer
  • 658
  • 1
  • 7
  • 19
4
votes
3 answers

Overlay SKScene on SKScene

Yes, I know what you're thinking... but this is not a duplicate.. I have 2 scenes, gameScene and menuScene. I want to overlay the menuScene over the gameScene. I know you can't present 2 scenes at once and I looked at solutions, they all suggest…
cooldood
  • 145
  • 9
4
votes
3 answers

SpriteKit/SKScene: How to draw from top-left instead from bottom-left?

As we know SKScene's origin is at bottom-left. But i try a simple level loading from a file which contains a matrix of 0 and 1. While 0 is nothing, 1 means a wall (simple rectangle). As the content of the file obviously goes from top-left to…
NovumCoder
  • 4,349
  • 9
  • 43
  • 58
4
votes
2 answers

Draw circles and other shapes with SpriteKit Scene Editor?

Tutorials online allude to creating circles and other shapes using the SpriteKit Scene Editor. One such example is this: https://www.raywenderlich.com/118225/introduction-sprite-kit-scene-editor. However, the only type of shape node available in the…
Crashalot
  • 33,605
  • 61
  • 269
  • 439
4
votes
1 answer

Overlay SKScene is not showing

I'm trying to overlay an SKScene over a SCNScene. When I run my app on the simulator and an iPhone6+, the overlayScene(SKScene) is shown as intended, but when I tried running it on the iPhone5 (tried 2 different devices) the overlayScene does not…
Joepoe
  • 41
  • 2
4
votes
1 answer

Game restarts after segue to gameOverViewcontroller

I have a problem with my sprite kit game, it restart immediately after i use a model segue to my gameoverviewcontroller. The fps also gets divide by 2 after each time a restart the game. So i actually need a way to delete the game after i use the…
Cing
  • 806
  • 1
  • 11
  • 29
4
votes
1 answer

Why does my ViewController not present another SKScene after reopening it?

so right now I'm programming a game and I'm experiencing an issue I didn't really found a solution for. I'll try to describe it for you. So, in order to be able to explain my problem better, I created a schematic drawing for you guys: Now here's…
Sam0711er
  • 834
  • 10
  • 24
4
votes
1 answer

Spritekit- Scene transition Delay

I have a main screen which has a button, when this button is pressed it should transition immediately to another scene, but it doesn't. It actually takes a few seconds. Is there a way that I could load all the nodes in that scene beforehand?…
Omar Dlhz
  • 158
  • 12
4
votes
2 answers

NSInvalidArgumentException when opening SKScene from UIViewController

I am creating my first SpriteKit game and here's what I am trying to do: 1. Remove default Main_iphone and Main_ipad storyboards Delete Main_iphone and Main_ipad listing from info.plist. Delete Main_iPhone.storyboard from Main Interface under …
4
votes
1 answer

How to switch SKScenes in SpriteKit with Swift properly?

I am developing a game with 3 different SKScenes(scene1, scene2, scene3). In GameViewController i initialize all of them like this: class GameViewController: UIViewController { var hero = Hero() var skView: SKView! var scene1: SKScene! var…
Sifeng
  • 713
  • 9
  • 23
4
votes
1 answer

how to present UIViewController from SKScene

Usaly when you present a viewController from another viewController you do: let vc : UIViewController = storyboard.instantiateViewControllerWithIdentifier("viewController") as UIViewController; self.presentViewController(vc, animated: true,…
tim_yng
  • 2,591
  • 4
  • 18
  • 20
4
votes
2 answers

What is the method unarchiveFromFile in GameViewController for?

When I tried to add different scenes to my game in Swift, I encountered the method unarchiveFromFile. The problem with this method is that it only works with the GameScene class. If you call it from extension SKNode { class func…
lisovaccaro
  • 32,502
  • 98
  • 258
  • 410
4
votes
0 answers

Compositing CIFilter with SKScene

Im trying to use a color dodge blend mode (CIFilter) on an image and composite it with my whole Scene (which is an SKScene node). CIColorDodgeBlendMode unfortunately does only take CIImage as an input for the Background. Is there possibly a…
keptn
  • 89
  • 8
4
votes
2 answers

SKView Flashing Gray before Scene

I have a main view of type UIView. This view has two skview's (left and right) in landscape only orientation. All views and scenes are set with a black background. I start out with the two skviews hidden. The main screen shows questions on…
C6Silver
  • 3,127
  • 2
  • 21
  • 49