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

How to use a SKEmitterNode in sprite kit to achieve a "fog of war" effect?

I'm trying to use a SKEmitterNode to create a shader, kind of like in Pokemon when you are in a cave: http://www.serebii.net/pokearth/maps/johto-hgss/38-route31.png Here is the code I have so far : NSString *burstPath = [[NSBundle mainBundle]…
2
votes
1 answer

How to delete nodes that fall below the screen in sprite kit?

i'm making a game where random obstacles fall from the top of the screen and the player has to avoid them. i'm having trouble implementing a method to delete the nodes (obstacles) that fall below the screen. although it may seem simple the way I'm…
user3469420
2
votes
3 answers

Can I slow down or stop physics in SpriteKit?

It seems to me that a framework that aims for simplicity would have that method so, and not to remove every node from the physics accounting like I'm doing now: [self enumerateChildNodesWithName:@"live" usingBlock:^(SKNode *node, BOOL *stop){ …
raej2010
  • 117
  • 2
  • 9
2
votes
1 answer

Sprite Kit Game: Telling Free Fall Death From Successful Jump

I have my first game application in development. In this game, the only character that the user controls will get to jump from one block to another. It's like Mario (in Mario Brothers) jumping from one moving lift to another. If he fails, he'll…
El Tomato
  • 6,479
  • 6
  • 46
  • 75
2
votes
2 answers

How to move SKSpriteNode between SKNodes

I want to move a SKSpriteNode from one SKNode to another. The removeFromParent method actually deallocates the sprite. For example in this code MySprite is a subclass of SKSpriteNode with a dealloc custom method that output a string, just to let me…
zago
  • 532
  • 2
  • 10
2
votes
3 answers

How to properly subclass SKNode when there is no init method?

SKNode only offers +node method. If you do this: + (instancetype)node { CustomNode *body = [CustomNode node]; // infinite loop } If you do this: + (instancetype)node { CustomNode *body = [super node]; // instance of SKNode, not…
openfrog
  • 40,201
  • 65
  • 225
  • 373
1
vote
3 answers

I want to reduce the code in methods that are basically identical and pass in the parameters but don't know where to begin?

I have a spriteKit project where I have many characters across several scenes. As a beginner I just built each one individually for each scene - which makes for a ton of extra code. I know I could clean this up with a "Build character class" or…
1
vote
0 answers

How to fill out an SKLabelNode with a specific color through animation?

I've been searching the internet for a while now and I couldn't come up with any solution. I've created a SKLabelNode in my SpriteKit project which displays level numbers. SKLabelNode: let levelLbl = SKLabelNode(fontNamed: "LEMON-Bold") …
1
vote
1 answer

Running SKActions on Multiple SKNodes in Sequence

I am creating a card game and having trouble having SKActions run in a sequence across multiple SK Objects (Nodes, Textures, Labels, etc.). Any help would be much appreciated! In the example below, I am trying to create a "dealing" motion. Where 1…
SharpSharpLes
  • 302
  • 4
  • 20
1
vote
2 answers

How do I scale SKNodes when you zoom in or out?

I've implemented a zoom feature, but the nodes I use to move the player, arrows pointing in the direction the player moves, stay the same size and I can't figure out how to scale them proportionally, so if I zoom in, the buttons get smaller and move…
Mazer
  • 21
  • 2
1
vote
0 answers

Joining two nodes using SKPhysicsJointFixed in SpriteKit

I want to create a fixed connection between two nodes using SKPhysicsJointFixed. Code: let joint = SKPhysicsJointFixed.joint(withBodyA: bodyA, bodyB: bodyB, anchor: anchor) physicsWorld.add(joint) Before (without joint): After (using code…
ixany
  • 5,433
  • 9
  • 41
  • 65
1
vote
0 answers

Moving SKNode position in Swift - Mancala Game

Hello Just to give a little context, I am trying to make a Mancala game in ios. I created the UI in the GameScene.sks file. xCode Screenshot I have each SKNode pit (pit0 is the bottom left pit and are numbered counter-clockwise from there)numbered…
1
vote
1 answer

Reduce the size of a SpriteKit Node

Im trying to change the scale of my Spritekit node and nothing is working. Ive tried .setSize(), .xScale(), .yScale(), .size = CGSize(width: 0.5, heightL 0.5) etc func view(_ view: ARSKView, nodeFor anchor: ARAnchor) -> SKNode? { let labelNode…
Cameron
  • 185
  • 2
  • 11
1
vote
0 answers

Draw connection line between two nodes in Spritekit, updates as nodes move?

I am trying to figure out what is the best way to draw a line between two SKNodes in SpriteKit, nodes that move each frame. [Example sketch below... the red line is what I want to draw] I can draw a line. At the moment I override the update call…
zumzum
  • 17,984
  • 26
  • 111
  • 172
1
vote
1 answer

SKNode not moving to programmed position

I have created an SKNode class that works perfectly fine. However, I can't change its .position after I have instantiated. The button does appear and function correctly but simply doesn't change position when programmed to. I have included the class…