Questions tagged [sknode]

The SKNode class is the fundamental building block of most Sprite Kit content. All visual elements in a Sprite Kit-based game are drawn using predefined SKNode subclasses.

331 questions
37
votes
4 answers

SKNode convertPoint toNode & fromNode confusion?

I am a little confused by how the SKNode methods convertPoint:fromNode: and convertPoint:ToNode: are working, I have looked at the docs but its not that obvious what they do. For example, this (see diagram below) is a small test I did using…
fuzzygoat
  • 26,573
  • 48
  • 165
  • 294
22
votes
1 answer

How to guide tvOS focus items for curved SKNodes

My tvOS app generates a game board using SKNodes that looks like the following: Each shape, separated by lines, is an SKNode that is focusable (e.g. each colored wedge is composed of 5 SKNodes that gradually diminish in size closer to the…
Aaron
  • 6,466
  • 7
  • 37
  • 75
13
votes
3 answers

SKLabelNode - how to center align when more than one line?

With SKLabelNode, it would appear that when you break to more than one line, the results is always abcde fg rather than abcde fg Really it seems that SKLabelNode is just left-aligned, and that's it. Is there a solution - how to make multiline…
Fattie
  • 27,874
  • 70
  • 431
  • 719
13
votes
2 answers

How to render a SKNode to UIImage

Just playing around with SpriteKit and am trying to figure out how to capture a 'grab' of an SKNode into a UIImage. With UIView (or a UIView subclass), I have used the layer property of the view to render into a graphics context. Eg. #import…
So Over It
  • 3,668
  • 3
  • 35
  • 46
12
votes
4 answers

Subclassing SKNodes created with SpriteKit .sks scene file

(this is for XCode 6 and iOS 8 beta 4) Love the new SceneKit editor. I'm successfully loading the scene from .sks file into a custom SKScene class. However, objects inside it are instantiated as default classes (SKNode, SKSpriteNode, etc), and i'm…
Rudi
  • 2,450
  • 5
  • 26
  • 37
11
votes
4 answers

SKNode scale from the touched point

I have added UIPinchGestureRecognizer to my scene.view to scale my content. I actually scale the parent node where all my visible contents reside. But I have problem though with scaling point. The thing is node scale from the lower-left corner.…
Mikayil Abdullayev
  • 12,117
  • 26
  • 122
  • 206
11
votes
3 answers

What is wrong with the coordinate system in this SpriteKit setup?

I created a SKView which presents an SKScene subclass like this: SKView *skv = [[SKView alloc] initWithFrame:self.view.bounds]; [self.view addSubview:skv]; self.skScene = [[TestScene alloc] initWithSize:v.bounds.size]; [skv…
openfrog
  • 40,201
  • 65
  • 225
  • 373
9
votes
3 answers

Bug: hit-testing with sibling nodes and the userInteractionEnabled property in Sprite Kit

Bug — hit-testing doesn't work as intended when siblings overlap: There are 2 overlapping nodes in a scene which have the same parent (ie. siblings) The topmost node has userInteractionEnabled = NO whilst the other node has userInteractionEnabled =…
Shuri2060
  • 729
  • 6
  • 21
8
votes
2 answers

Creating a trail with SKEmitterNode and particles in SpriteKit

I am trying to make it so a particle I made follows the player whenever the player is moved. The effect I am trying to replicate is like when you are on a website and they have some sort of set of objects following your mouse. I tried to do this by…
EvilAegis
  • 733
  • 1
  • 9
  • 18
7
votes
3 answers

Strange Exception with GameCenter

I keep getting this crash report from GA and users... However i cannot reproduce this exception by testing iphone5,5s,6 with both ios7 and ios8. This issue comes nowhere when application did enter to background. The strange part is that gamecenter…
WeiHan Hung
  • 155
  • 1
  • 7
7
votes
4 answers

Can't tap SKSpriteNode - no touch detected ios

I am pretty new to iOS, objective C and working with Xcode. I only did one simple news type app, but now I would like to create a game I had published on another platform. Basically, I have one object that will appear randomly and then fade out and…
Deea B
  • 301
  • 6
  • 15
7
votes
1 answer

How to subclass an SKNode to initialize it with a predetermined size

SKScene is a subclass of SKNode and we can initialize it with a certain size. But SKNode itself lacks this ability and its size is the smallest rectangle that contains the children. Sometimes I need my SKNode to stretch to the window no matter how…
Mikayil Abdullayev
  • 12,117
  • 26
  • 122
  • 206
7
votes
1 answer

Jumping to a specific SKNode in node hierarchy

I have noticed that the SKNode methods children and childNodeWithName: as the name implies only return results from the children directly below the queried node. i.e. [root children]; will return an NSArray containing the nodes @[CUBE1, CUBE2,…
fuzzygoat
  • 26,573
  • 48
  • 165
  • 294
6
votes
2 answers

SpriteKit: find all descendants of SKNode of certain class?

This question shows how to find all children of a SKNode that belong to a certain class, but what if we want all descendants (e.g., grandchildren) that belong to a certain class? Is there a native way to do this in SpriteKit, or is the only option…
Crashalot
  • 33,605
  • 61
  • 269
  • 439
6
votes
1 answer

Loading an SKNode from a .sks scene file in Swift

I want to use multiple .sks files to store some complex SKNode hierarchies such as game menus. I have a background with moving objects I'd like to keep throughout the game, so presenting different SKScenes doesn't achieve what I want. I am…
mogelbuster
  • 1,066
  • 9
  • 19
1
2 3
22 23