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

SKPhysics turn off isDynamic after it reaches a certain position

How can I go about approaching this? I want to turn off isDyanmic after my sprite has approached a certain position. So basically how do I do something after something has occurred in swift? Thanks in advance
phindle
  • 73
  • 5
-1
votes
3 answers

How to change node value

func createBall(){ ballS = SKNode() let ball = SKSpriteNode(imageNamed: "Ball") saw.zPosition = 2 ballS.addChild(ball) self.addChild(ballS) } This creates a Ball node with z position 2. But while running…
-1
votes
1 answer

How to instantiate SKSpriteNode spritekit swift 3

I have a 2 player space shooter game and am having trouble with the shooting part. I currently have a ship that moves it's x position with your finger. I want it to shoot strait up when the user pushes the "fire" button. So here is my question. How…
c3pNoah
  • 65
  • 1
  • 12
-1
votes
1 answer

Calling a node in GameScene.sks from GameScene.swift error

I've placed a Color Sprite in GameScene.sks and named it line1LightLeft and gave it the texture named arrowLeftOff. Now I want the image to change in GameScene.swift. So I first want to connect the node in the .sks to the .swift. var line1LightLeft…
Delah
  • 41
  • 7
-1
votes
1 answer

SKSpriteNode not responding to set color & blendModeFactor (SpriteKit & Swift)

I know there are several other posts about this, but my case is kinda specific, i haven't seen this one yet. I have in my game a ball-shaped sprite, that whenever I tap on it, I would like to add a colorised version of the very same sprite but with…
msqar
  • 2,940
  • 5
  • 44
  • 90
-1
votes
1 answer

Are there tools for building CGPaths? (either in XCode/Swift or other)

I'd like to make SKSpriteNodes to move along letter outlines. I have many letters but here's one example: I would like the sprite to follow the red line. I know this can be accomplished by creating appropriate CGPaths for each letter but I have…
user594883
  • 1,329
  • 2
  • 17
  • 36
-1
votes
2 answers

touchesBegan Swift 2 custom SKSpriteKit Nodes

I am new to creating games and such so as a practice I am making a silly game currently. This game has a briefcase which contains buttons (0-9) I would like to save the value of the number that was pressed in an array. I am unsure of how to use…
Avi
  • 17
  • 6
-1
votes
2 answers

Having trouble moving my skspritenodes EDIT:

func increaseSnakeLength(){ snakeArray.append(snakeLength) inc += snakeBody.size.height if snakeMovingLeft == true{ snakeLength = SKSpriteNode(texture: nil, color: UIColor.blueColor(), size: CGSizeMake(20, 20)) …
user3856516
  • 31
  • 1
  • 7
-1
votes
1 answer

Detect the degrees in a circle with users touch

Im looking to create a swift function to return the degrees (Float) of the users touch on an image (SKSpritenode). In touchesBegan, I know how to detect the x & y positions of my image. The idea is to create a function that takes in these positions…
pete
  • 2,980
  • 4
  • 22
  • 34
-1
votes
2 answers

Animating the rotation of a SKScene has no effect

I have two nodes in my scene. One is ball and one is background. Both are added to the scene as childs. When the ball gets hit to the wall, I am trying to rotate the ball. if (!firstNode.physicsBody.resting) { //first node gets the…
Teja Nandamuri
  • 11,045
  • 6
  • 57
  • 109
-1
votes
1 answer

Swift 2.0 - SKSpriteNode's SKTexture sometimes does not show

I have a problem concerning SKSpriteNode Textures that are not drawn to the screen. This problem appeared out of the blue and I took me quite a while to hunt it down to its origin, but I'm still looking for a solution. What I'm doing is simple: I'm…
Warat
  • 1
  • 2
-1
votes
1 answer

Re-spawning in different locations (generating new value)

I've got this set of code that spawns a SKSpriteNode within a set location (using rect), but I'm trying to make the Node disappear but then reappear after a set amount of time in a different location. I've been looking a NSTimer but not sure how to…
MattB
  • 13
  • 4
-1
votes
1 answer

Removing Elements From Arrays in SpriteKit/Swift

When you remove a SpriteNode from Parent in SpriteKit, does it automatically remove it from any arrays that it is in? Also, when you remove an element from an array, does every other element shift or is there a gap where the element used to be?
Tommy
  • 140
  • 8
-1
votes
1 answer

Confusion with gravity on SpriteKit

When scene init I set world gravity -2.0f. And I added object on scene and joystick node, which I control this object. When I touch joystick node, world gravity set to 0, and when end touch joystick, world gravity set to -2.0f. I can`t understand,…
Sergey Krasiuk
  • 198
  • 2
  • 9
-1
votes
2 answers

Displaying random text using SKLabelNode

I'm new to this sprite kit.I want to display the text randomly.Actually i'm having 3 words i need to display those 3 words randomly using SKLabelNode.I don't know how to implement this.Let us take Air,Land and sea these 3 words should be randomly…
App Developer
  • 419
  • 1
  • 3
  • 16