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

Positioning new SKSpriteNodes at corners of existing rotated SKSpriteNode

I need to spawn 4 new SKSpriteNodes (independent not parented) at the corners of an existing sprite. Its pretty basic stuff but I am struggling to find the correct formula, I though I had it but its not working as expected. Could some either point…
fuzzygoat
  • 26,573
  • 48
  • 165
  • 294
-1
votes
2 answers

Cannot assign PhysicsBody and property to an SKSpriteNode?

I'm building a function in which a random variable will choose 1 in 4 SKSpritenode in an array and assign itself to it. However, that randomline, although appear as expected on the screen, does not contain any physicsbody property so it cannot be…
Khoi Le
  • 3
  • 4
-1
votes
1 answer

UIView.animate() does not animate the thing

I'm trying to animate sprite resizing. Size changes, but without any animation. Here's the problematic code: func layout_scene() { backgroundColor = UIColor(red: 14/255, green: 145/255, blue: 137/255, alpha: 1.0); var char_trail:…
-1
votes
1 answer

Why does Xcode TouchesEnded() topMost touched node always return child nodes rather than the parent node?

I have Subclassed SKSpriteNode as a MenuButton() The MenuButton() contains 2 children: SKSpriteNode (an Image) SKSpriteNode (some text) When the below runs, if the user touches part of the button containing the image or the text (the children of…
Ryann786
  • 289
  • 4
  • 12
-1
votes
1 answer

Spawn SKSpriteNode objects at random times

I am making a game where I would like to spawn obstacles at random times. The obstacles are going to make contact with the player. Here the code that I have: var obstacle : SKSpriteNode? func createObstacles() { let obstaclesArray = ["obstacle_1",…
Mich1394
  • 5
  • 5
-1
votes
1 answer

how to remove the sprite after three hits on it

I am learning to make games on swift and spritekit, but stuck in one place. I managed to make the "enemy" and "bullet" removed after the first collision. Tell me, please, how to remove the "enemy" after a "bullet" hit it three times. I have been…
D.Denis
  • 3
  • 1
-1
votes
2 answers

Swift: Index Out of Range Error when Populating Two-Dimensional Array

I just started to learn Swift and I would like to code the game BubbleBreaker which I have already created in both Java and C# some years ago. For this, I wanted to create a two-dimensional array of Bubble (which is derived from SKSpriteNode),…
-1
votes
1 answer

Adding a box shadow error - Cant tap on my button - SpriteKit

I am trying to make a button with a nice soft box shadow around it to make it look a little 3d. I have a normal button I imported and a extension on SKSpriteNode When I click on the button it goes to my next scene (GameScene). Although, when I apply…
Pegasus
  • 85
  • 1
  • 14
-1
votes
2 answers

In Xcode how would I get a SkSpriteNode to move up when clicked on?

How do I get the SkSpriteNode to move up when clicked? -Thanks https://i.stack.imgur.com/fcOvr.png
Maddog
  • 11
  • 1
  • 2
-1
votes
1 answer

Show direction to CGPoint SpriteKit

I need an arrow (white circle) that shows the direction to CGPoint while user move his icon and camera. I mean that arrow (white circle) needs to take position on the edge of visible screen and shows the way that helps user to return to followed…
-1
votes
1 answer

SKSpriteNode touch not detected

I am trying to implement a pause button in my game. However every time I tap the pause button (SKSpriteNode) on my iOS Device nothing happens. I have tried making the button do other actions and tried making other sprites do the action. None have…
Thomas
  • 37
  • 1
  • 1
  • 6
-1
votes
1 answer

how to have image in a class which inherits SKSpritenode

I can create an instance of SKSpriteNode class like this let dog = SKSpriteNode(imageNamed: "Dog01") However, how do I do this it if I want to create a custom class which inherits from SKSpriteNode? E.g. class Dog : SKSpriteNode { } It looks…
-1
votes
1 answer

Why does the app lag a lot when calling functions

I am building a game that requires a function (out of several) to be called depending if a condition is true or not. The condition checks the variable every 0.0001 seconds for game purposes, but the functions are called every 4-6 seconds. I just…
Alex Merlin
  • 341
  • 1
  • 3
  • 12
-1
votes
1 answer

Text disappearing after I pause a game in SpriteKit

When ever my game pauses, the text hides. I have no clue why but I can't figure it out. Here is my code: self.isPaused == true if let label = self.label1 { label.alpha = 0.0 label.run(SKAction.fadeIn(withDuration: 0.0)) self.label =…
Jordan Heath
  • 114
  • 8
-1
votes
1 answer

Gamescene spriteNodes in array

Getting an error on this pice of code. I Don't want to go through the spriteNode on GameScene.sks manually (in code) - the for loop must work somehow? Any ideas... let sprites:[SKSpriteNode] = [block1, block2, block3, block4, block5, block6,…