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
2
votes
2 answers

What is the difference between SKNode's position property and GKAgent2d's position property

SKNode has a position property which represents the node's position in parent. Whereas GKAgent2D also has a position property which according to the documentation is its position in 2D space. How are these two related? And how do we convert between…
nata11
  • 109
  • 1
  • 8
2
votes
1 answer

How to put objects on different Z layers in SpriteKit

In my game I am trying to put images on different layers so that it is clear where things are. E.g. Terrain is at Z layer 0, while improvements and cities are at Z layer 1, while units are at a higher layer. I am following a tutorial…
Student-LTB
  • 103
  • 8
2
votes
1 answer

Swift 3 (SpriteKit): Create a texture from a node tree

I have been trying to render a node tree into an SKTexture as a possible solution to another question here. I tried searching for an answer to this, and I came across one of Apple's Developer pages (view it here). It says the command which converts…
J.Treutlein
  • 963
  • 8
  • 23
2
votes
1 answer

When subclassing SKNode, should the Frame property return a non-empty value?

I'm subclassing SKNode to render a map that consists of many SKSpriteNodes by adding those nodes to my subclass. All is working well but I noticed that the Frame of my node subclass is always 0. I couldn't find anything about this in the docs, so:…
Krumelur
  • 32,180
  • 27
  • 124
  • 263
2
votes
1 answer

Updating SKLabel text through an SKNode subclass

My Goal: add one to the amount variable of the Achievements Class and then update the text so it shows on the SKLabelNode called "AmountLabel" So I have a subclass of SKNode that shelters my SKSpriteNode that shows the emblem of the achievement and…
Astrum
  • 375
  • 6
  • 21
2
votes
1 answer

spritekit how to transition two SKAction on two different nodes

I have two nodes node1 and node2. node1 is at position 0. when I click on the screen it run its action until its in the middle of the screen or the user removes their finger from the screen. Once node1 reaches the middle of screen it will stop, and…
2
votes
1 answer

Rendering a big grid with SpriteKit

I'm a total newcomer to SpriteKit and game development in general, I've been toying with SpriteKit to make a strategy game set in space. My backend architecture use a grid system to represent the Universe, I have empty cases and cases with…
Dimillian
  • 3,616
  • 4
  • 33
  • 53
2
votes
1 answer

SKSpriteNode chain

I would like to make "aware" SKSpriteNode aware that touch is outside the node.(for example changing color) I would like to use tuochesMoved (out of node) if it is possible I don't want to connect them in any other way. Those spries should be…
Mamazur
  • 175
  • 2
  • 8
2
votes
2 answers

How to rotate SKNode in swift

I want my SKNode To rotate like Image below :) Image Here Instead it is rotating around the bottom left corner of the screen! Click Here To View Video of what is happening that I do not want How do i get it to rotate counterClockWise or Clockwise in…
Amen Parham
  • 73
  • 1
  • 8
2
votes
1 answer

SpriteKit : enumerateBodiesAtPoint not showing correct bodies

I have a few non-completed-circles rotating constantly and a user going from circle to circle. I removed all gravity, forces etc from my scene Image A Image B Problem : I am trying to do a hit detection where I just check where the user is, and if…
2
votes
1 answer

SpriteKit: Why containsPoint of SKNode returns false

I have a SKNode with userInteractionEnabled=true and touchesEnded overridden. Since touchesEnded will be called at any time even when i move my finger out of the SKNode i want to be sure the touch ends within the SKNode, only then i want to count…
NovumCoder
  • 4,349
  • 9
  • 43
  • 58
2
votes
1 answer

SpriteKit: center SKNode in scene

I'm having trouble centering a SKNode on my main scene. This (photo below) is a SKNode that contains 16 SKLabelNodes. In the code, it sits at position (0, 0), but as you can see on the image, it doesn't seem to be centered. Also, Apple documentation…
José María
  • 2,835
  • 5
  • 27
  • 42
2
votes
0 answers

Swift: If SKNode color matches background color

I'm currently learning swift and i'm having some difficulty. In my game a random background color changes every time to a random color between Red Green and Blue. let colorgen = arc4random_uniform(3)+1 if colorgen == 1{ Col =…
2
votes
1 answer

SpriteKit. Is it possible to scale parentNode without scaling childNode?

I'm wondering is it possible to scale parentNode without scaling it's childNode using spritekit? Because during game process i want to run scale action only for one part of the node(in my case its parent). So if somebody can help i'll be glad.
RootiK
  • 23
  • 4
2
votes
1 answer

SpriteKit What is a node?

I'm new to programming in Swift in general and I was reading up on SpriteKit. I'm looking through a lot of tutorials and they keep talking about nodes. The funny thing is, I can't seem to find what a node is.... Can anyone give me a good explanation…
bc5803
  • 29
  • 1