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

Finding absolute position of child SKNode?

I have an SKSpriteNode that is parented to (i.e. a child of) a scrolling background. The SKSpriteNode does not move itself, it just moves along with the scrolling background. What is the best way to find the absolute position of the SKSpriteNode as…
fuzzygoat
  • 26,573
  • 48
  • 165
  • 294
6
votes
1 answer

SKNode position not working, always going to default 0,0

I have fairly well developed SpriteKit game I'm working on, added some code to add a new SKSpriteNode to the Scene, (same as I have done dozens of other places in the code, but for some reason this time it is just ignoring the position I have set…
Speckpgh
  • 3,332
  • 1
  • 28
  • 46
5
votes
2 answers

Fading a shadow together with the SKSpriteNode that casts it

Here's my setup, using Sprite Kit. First, I create a simple sprite node within a SKScene, like so: let block = SKSpriteNode(color: UIColor.redColor(), size: CGSizeMake(90, 160)) block.zPosition = 2 block.shadowCastBitMask = 1 addChild(block) Then…
Gamma
  • 1,347
  • 11
  • 18
5
votes
2 answers

Sprite Kit Remove SKNode From Parent When Off Screen

I would like to know how to remove my SKNodes when they are off screen to help my game run more smoothly. How To Do This On Sprite Kit Thanks So Much
user3773099
  • 73
  • 1
  • 3
5
votes
1 answer

Sprite Kit bodyAtPoint and bodyInRect return incorrect values?

I created a very simple sample code, just one scene, one sprite node 20x20px, at point 0.0 on screen. When I call scene.physicsWorld bodyAtPoint it returns me this node even at point eg: 34x34. But at point 35x35 it returns null. So basically all…
DamianD
  • 101
  • 1
  • 4
4
votes
1 answer

Remove a specific list of SKAction from a SKNode

During the development of some interactions between different nodes, I realized I need to remove a specific list of actions from a node. The current version of Sprite-Kit framework provides some instance methods as: removeAllActions() action(forKey…
Alessandro Ornano
  • 34,887
  • 11
  • 106
  • 133
4
votes
1 answer

SpriteKit missing linear transformation matrices

Does anyone know how to transform (rotate,scale,skew) SpriteKit nodes using transformation matrices. couldn't find any support for this in the Spritekit API.
4
votes
3 answers

SpriteKit: detect complete node overlap

I have two SKShapeNodes – one with an edge-based SKPhysicsBody, one volume-based – and I want to detect their intersection without collision. I've got this working fine, with the SKPhysicsContactDelegate contact methods getting called as one passes…
flatpickles
  • 2,198
  • 2
  • 15
  • 21
4
votes
1 answer

SKLabelNode positioning not working as expected

I am working on a game and i need to implement the top bar, holding the details like score and other stuff. My top bar should have the following (left to right): - a 50x50 icon that changes according to level, but it's the same size - a label with…
Deea B
  • 301
  • 6
  • 15
4
votes
2 answers

IOS: Cannot get correct screen size

I tried to display some SKNodes and I used the width and height of screen to set their positions in order to make them compatible with different screen sizes. SKNode* obstacle = [SKSpriteNode spriteNodeWithColor:[SKColor greenColor]…
tingxuezisu
  • 41
  • 1
  • 2
3
votes
2 answers

Reducing number of draw counts (passes) in SpriteKit

I would like to optimize draw counts, but don't know where to start. Can someone briefly explain ( or point me in the right direction ) which factors affect draws, is there a way to view/debug them and are there any optimization tips? What is the…
elektricni
  • 319
  • 1
  • 5
  • 12
3
votes
2 answers

isPaused not working properly in SKNode()

I'm making a card game with Swift 4 and SpriteKit. I made a custom subclass of SKScene, and inside this class is a SKNode which I'm using as a layer (gameLayer), to which I attach all Nodes, which shall be stopped. I also have made a button, which…
Sergey
  • 43
  • 4
3
votes
2 answers

How to create realistic spinning wheel in SpriteKit

I am trying to create a spinning fortune wheel action via SKAction. I have a SKNode which used as wheel, this SKNode is a circle that divided to four quarters (each quarter in different color). also I set an SKAction (which is repeating for 10…
omerc
  • 179
  • 1
  • 11
3
votes
1 answer

best way to detect if node touch the frame

Im building some game with SpriteKit that include balls as SKShapeNode. I create a class that define the balls and their properties (including SKPhysicsBody). the balls should run on the screen, and the frame is the screen border (by using…
omerc
  • 179
  • 1
  • 11
3
votes
2 answers

SpriteKit: run code or block when action removed?

The run function for SKNode lets you run a block when the action completes, but what if the action is cancelled/removed via removeAllActions? Cancelling an action doesn't invoke the completion block from the run function. Is there a callback or way…
Crashalot
  • 33,605
  • 61
  • 269
  • 439
1
2
3
22 23