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
7
votes
2 answers

SKLightNode cast shadow issue

I have been unsuccessful in getting a SKSpriteNode to cast a shadow AND also be made to disappear when going into a shadow from the same light source. I am able to do one of the two but not both. According to the docs: If the sprite is inside a…
sangony
  • 11,636
  • 4
  • 39
  • 55
7
votes
3 answers

Confusion about coordinates, frames & child nodes in SpriteKit on iOS?

I'm still playing around with learning SpriteKit in iOS & have been doing lots of reading & lots of experimenting. I'm confused by something else I've found* regarding coordinates, frames & child nodes. Consider this snippet of code, in which I'm…
WonderMonster
  • 220
  • 3
  • 9
7
votes
1 answer

How to change a spritenode opacity

I'm working using XCode 6, Sprite Kit and Swift and I have a node with this declaration: var red = SKSpriteNode(imageNamed: "Rectangle") and I want to change the opacity of the node, but I don't find how, except using a SKAction like FadeIn,…
Drakalex
  • 1,488
  • 3
  • 19
  • 39
7
votes
2 answers

Pause SpriteKit game with Physics SKSpriteNode child

I have a SKSpriteNode with a dynamic physics body on a SKNode *_fgLayer. Now, when I pause or unpause the game I want that SKSpriteNode to remain in place and not rotate or fall down. If I simply use _fgLayer.paused = YES; the SKSpriteNode does not…
7
votes
4 answers

Can't tap SKSpriteNode - no touch detected ios

I am pretty new to iOS, objective C and working with Xcode. I only did one simple news type app, but now I would like to create a game I had published on another platform. Basically, I have one object that will appear randomly and then fade out and…
Deea B
  • 301
  • 6
  • 15
7
votes
2 answers

Why is the coordinate system in sprite kit flipped and can I change that globally?

I noticed that in Sprite Kit the coordinate system is flipped. For example, here is a SKSpriteNode: SKSpriteNode *car = [SKSpriteNode spriteNodeWithImageNamed:@"car"]; car.position = CGPointMake(0, 0); [road addChild:car]; The car is positioned in…
openfrog
  • 40,201
  • 65
  • 225
  • 373
6
votes
2 answers

How do I rotate a SpriteNode with a one finger “touch and drag”

How do I rotate a SpriteNode with a one finger “touch and drag” so that: It doesn’t jerk around It moves in a circle (I’ve successfully accomplished this part several times- both with a code only solution and with an SKS file) It produces a…
William Chadwick
  • 134
  • 2
  • 15
6
votes
1 answer

iOS: How to set programmatic alpha mask of SKSpriteNode

I am able to set the alpha mask of my own custom object in the .sks file of the project, but I'm not sure how to do it programmatically.
6
votes
3 answers

Animating individual characters in a SKLabelNode

Is there a more efficient way to animate text shivering with typewriting all in one sklabelnode? I'm trying to achieve the effect in some games like undertale where the words appear type writer style while they are shivering at the same time. So far…
lws803
  • 907
  • 2
  • 10
  • 21
6
votes
1 answer

HitTest for SKSpriteNode

This is my problem: I work with SpriteKit and I want to ignore touch event when it occurs in some rectangle (prevent calling touchesBegan). The way how I would like to do it is something like "overriding the hitTestWithEvent of UIView". But I can't…
ukaszm
  • 254
  • 2
  • 9
6
votes
2 answers

Swift 3 (SpriteKit): Locking the x axis of a SKSpriteNode and its physicsBody

I really need to know how to lock the x axis of an SKSpriteNode and its physicsBody. I need to keep the SKSpriteNode dynamic and affectedByGravity. The node is on a slope, so this is why it's x axis is moved due to gravity. However, I don't want the…
J.Treutlein
  • 963
  • 8
  • 23
6
votes
1 answer

Setting SKLabelNode to centre of SKSpriteNode Swift

I'm trying to set a SKLabelNode's position to the center of a SKSpriteNode. I've looked at other questions on this but none of these work with Swift 3. This is my code: var letter1background = SKSpriteNode(imageNamed: "letterbackground") var…
Niall Kehoe
  • 379
  • 2
  • 5
  • 18
6
votes
1 answer

SpriteKit: why node in collision has category bit mask of 4294967295 when this category was never assigned to a node

In the didBegin function below, one of the nodes has a category bit mask of 4294967295. However, this category is never assigned to any node. Here are all the bit masks in use: struct PhysicsCategory { static let None : UInt32 =…
Crashalot
  • 33,605
  • 61
  • 269
  • 439
6
votes
3 answers

Circling the drain of Initialization in subclass: Swift and SpriteKit

I want to create a SKShapeNode at a higher level than the touchesBegan of a SpriteNode so when I want to add the SKShapeNode to the screen from the touchesBegun event on this sprite, the shape already exists, and I simply add it to the screen from…
Confused
  • 6,048
  • 6
  • 34
  • 75
6
votes
1 answer

My Physics Contacts are not making contact in SpriteKit

I am using Xcode 7.3.1, iOS 9.3 and Swift 2. Also tested on simulator and my iPad directly. I have done numerous searches, read 2 books of Spritekit Physics and watched numerous video tutorial as well as written ones. I have written body physics…
1 2
3
94 95