Questions tagged [skspritenode]

An SKSpriteNode is a node that draws a textured image, a colored square, or a textured image blended with a color.

An SKSpriteNode is a node that draws a textured image, a colored square, or a textured image blended with a color.

SKSpriteNode is part of , a graphics rendering and animation infrastructure to animate arbitrary textured images, or sprites.

is available on iOS () and OS X ()

Click Here for Apple Docs.

1417 questions
-1
votes
1 answer

Swift - sprite kit - make SKPhysicsJointPin have less motion

I'm trying to create a snake with multiple body parts that moves left and right. Im using a pin, but upon the snake stopping, the body keeps moving and doesn't stop. I've messed around with the max and min angles, and the torque, but nothing seems…
Drew Wood
  • 91
  • 1
  • 10
-1
votes
3 answers

How can I get the number of skspritenodes in a scene?

I want to find out what the number of nodes is in a scene. For example, I want to create an if statement so that if the number of nodes in the scene is 0 or any other number, I would call a function. This is what i have done but it only calls the…
Mostafa Mohsen
  • 43
  • 1
  • 12
-1
votes
2 answers

SpriteKit Lagging on iPhone 5 but not on iPhone 6

I have been working on my first SpriteKit game that perfectly works on iPhone 6 but not on iPhone 5 (iOS 8.2 on both, written in Swift). I explain my problem: there is a simple ball (a SkShapeNode) that bounces when tapping on the screen. The move…
Jonathan
  • 11
  • 4
-1
votes
2 answers

SKSpriteNode moveTo:X for all in array

for (int i = 0; i < [playerCards count]; i++) { int cardsLaid = i * (cardDisplay.size.width / 3); CGPoint forPoint = CGPointMake((0.5 - (self.frame.size.width / 4)) + cardsLaid, 0.0); playerCards[i] …
user2415313
  • 101
  • 1
  • 10
-1
votes
1 answer

Error when creating a ball object out of a skspritenode

I created a ball object to later show on screen when I tap it. However when I try to do that, it gives me an error. Unfortunately i can't make something out of it. ballClass.h: @import SpriteKit; #import "ballClass.h" @implementation ballClass +…
-1
votes
1 answer

Detect length of press SKSpriteNode

I have a SKSpriteNode and I need to detect how long it is pressed. Is there any possible way to do this?
zbz.lvlv
  • 3,597
  • 6
  • 34
  • 38
-1
votes
1 answer

Subclassing a Method Returning instancetype

I have a custom class which is a subclass of SKSpriteNode. I am trying to override the spriteNodeWithColor:size: method which returns instancetype. I try this: -(instancetype)initWithColor:(UIColor *)color size:(CGSize)size{ self.color =…
67cherries
  • 6,931
  • 7
  • 35
  • 51
-1
votes
1 answer

How to move sprites immediately inside the loop (FOR,WHILE ..)

I making a puzzle game and I get a problem when I try to move sprite to a new position by using SKAction moveTo. Here is my case: I have 4 sprites in list and I want to move them to new position by putting them in for loop and using moveTo action.…
lionK
  • 27
  • 8
-2
votes
1 answer

How to tell Swift to use pixels or points?

Yes, still very new to Swift, but in my current (first) app I started off positioning and sizing SKSpriteNodes in pixels. Now all of sudden I had to switch over to points, because everything was blowing up. I have narrowed the cause to my applying…
Caractacus
  • 83
  • 7
-2
votes
1 answer

Are sprites automatically removed?

I'm currently trying to code some falling stars in my game, and they seem to disappear once they move out of the screen. But I'm not sure if swift is actually automatically deleting for me, or if they're still lingering around. I'm starting them at…
Shisui
  • 1,051
  • 1
  • 8
  • 23
-2
votes
1 answer

Can't find the value when initialising a node

I'm a beginner programmer. Please help. Can't find the value when unwrapping the childNode. Not sure why. Please help, thanks My code: var someParentNode = SKSpriteNode() var someChildNode = SKSpriteNode() override func didMove(to view: SKView)…
MyName
  • 31
  • 3
-2
votes
1 answer

How to keep multiple SKSpriteNode loosely together

How can I ensure the cards always stay close to each other as shown below? The player may pick one or more cards, and I need to ensure the remaining cards snap back together. Also if the player abandons picking (thats is draws out and releases),…
xoail
  • 2,978
  • 5
  • 36
  • 70
-2
votes
1 answer

How to change an SKSpriteNode image once a condition is met?

I'm trying to change the image of the SKSpriteNode in my shop scene when an upgrade is bought, I believe I'm on the right track with the variable, but I think I am doing it wrong. Thanks for the help in advanced, I've been trying for a while to…
-2
votes
1 answer

How to implement effect when SKSpriteNode is transparent but become visible with light?

I would like to implement the effect when transparency of SKSpriteNode changes when it illuminated by light. By default SKSpriteNode is transparent but become visible with light.
Daniil
  • 143
  • 3
  • 9
-2
votes
1 answer

Changing the color of an SKSpriteNode image?

I was wondering if there was a way to change the color of an SKSpriteNode programmatically?? Say I have a texture for an SKSpriteNode that is a box that has a black outline and a white fill color. How would I be able to change the white fill color…
1 2 3
94
95