Questions tagged [sktexture]

An SKTexture object is an image that can be applied to SKSpriteNode objects or particles created by a SKEmitterNode object.

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

is available on iOS () and OS X ()

145 questions
2
votes
4 answers

How to merge SKSpriteNode into a SKTexture to form new SKSpriteNode in Swift 3?

I'm developing an ios app. I have a SKSpriteNode on screen and I'm getting a drawing from the user that I'm storing as SKTexture. I would like to combine these two and introduce them as a new SKSpriteNode. THE PROBLEM: I cannot find documentation…
user594883
  • 1,329
  • 2
  • 17
  • 36
2
votes
1 answer

SpriteKit SKTexture mipmap doesn't work

I cannot figure it out how to apply mipmaps for SKTexture texture. I'm using XCode 8.2.1 with Swift. Here is my method: override func sceneDidLoad() { logo = childNode(withName: "logo") as! SKSpriteNode let texture: SKTexture! =…
widesteppe
  • 175
  • 3
  • 10
2
votes
1 answer

Swift 3 (SpriteKit): Create a texture from a node tree

I have been trying to render a node tree into an SKTexture as a possible solution to another question here. I tried searching for an answer to this, and I came across one of Apple's Developer pages (view it here). It says the command which converts…
J.Treutlein
  • 963
  • 8
  • 23
2
votes
2 answers

How do I convert a PNG with alpha to RGBA4444 for using it in SpriteKit SKTexture?

I have a stack of transparent PNGs that I'd like to use in a SKSpriteNode animation with SKTextures. I'd need to adjust the memory usage of SKTextures by reducing texture quality down from RGBA8888 to RGBA4444. How would I initialize SKTexture with…
Markus Rautopuro
  • 7,997
  • 6
  • 47
  • 60
2
votes
2 answers

Folder of images: create and fill SKShapeNodes, 1 of each

Is it possible to create a folder and have SpriteKit go through that folder, find each image (regardless of name), and create a SKShapeNode for each in that folder (regardless of how many there are)? Assume all images are the same size, and all .png…
Confused
  • 6,048
  • 6
  • 34
  • 75
2
votes
1 answer

Creating SKSpriteNode from SKTexture using pixeldata

I'm trying to create a SKSpriteNode from a 2D-Array of RGBA objects which represents the pixels in a image I want to create. But I don't know how to do it, and I searched for tutorials and could not find one. For example: struct RGBA { var r:…
desperado
  • 213
  • 1
  • 11
2
votes
1 answer

What's wrong with this SKShapeNode gradient coloring code?

I'm trying to create gradient colored SKShapeNode. I found the code below from theGoogle but it only works when color1 is black, e.g. defined as follows: CIColor.init(red: 0, green: 0, blue: 0, alpha: 1.0) The second color can be anything. enum…
user594883
  • 1,329
  • 2
  • 17
  • 36
2
votes
1 answer

Animate an SKSpriteNode with textures that have a size different from the original

I want to animate an SKSpriteNode using textures from an SKTextureAtlas, using SKAction.animateWithTextures(textures,timePerFrame,resize,restore). However, the textures in the atlas have a size that is slightly larger than the original texture (it's…
David
  • 437
  • 1
  • 4
  • 15
2
votes
2 answers

Replace a color/colour in a SKSpriteNode

I want to change a single, specified colour in my SpriteKit sprite to alpha, leaving all other colours unaffected. I don't think that there is an 'easy' way to do this and that a custom shader might be required. Does anyone know how to do this in…
Steve Ives
  • 7,894
  • 3
  • 24
  • 55
2
votes
3 answers

SpriteKit: Using SKTextureAtlas causes incorrect Physics Body

I am building my first sprite kit game, and recently read an article that said to use SKTextureAtlas to improve performance. So I migrated all my sprite images into organized .atlas folders and updated the code accordingly. However, now my sprites…
JimmyJammed
  • 9,598
  • 19
  • 79
  • 146
2
votes
1 answer

Swift SpriteKit change background image score based

i am developing a game using Swift and SpriteKit. I want that the background changes at a certain score. Here is the code: class GameScene: SKScene { var bg = SKSpriteNode() override func didMoveToView(view: SKView) { makeBg() } func…
Swift1
  • 349
  • 1
  • 4
  • 22
2
votes
1 answer

Swift - Change SKSpriteNode texture using an array of textures

I am trying to animate a SKSpriteNode using an array of textures. What I am trying to achieve is to iterate through the texture array and change the SKSpriteNode texture through each iteration and display it's change for about 1 second. The only…
Electric
  • 115
  • 10
2
votes
1 answer

Nodes not loading textures in Swift 2 and SpriteKit

So I am making a sand falling puzzle game, where you have to get the sand particles into the goal. Before the Swift 2, iOS 9, xCode 7 updates, my nodes were working fine. But now, when I load the game, it doesn't properly load all of the nodes. Take…
Logan Jahnke
  • 815
  • 8
  • 21
2
votes
1 answer

How to determine if SKTexture uses an @2x or @3x image?

Is there a way to determine whether an existing SKTexture uses a @2x or @3x image version? I could look at the texture's size and compare them but I was wondering if there's a more elegant way to do it, preferably without using a UIImage.
CodeSmile
  • 64,284
  • 20
  • 132
  • 217
2
votes
1 answer

Swift Syntax Update? Classes not allowed in protocol. Can't fill SKTexture

I'm currently working on a tutorial for creating an iOS Isometric Game. You can find this one here. I just started coding Swift and because a lot of Syntax errors appeared while working with tutorials a little older than 3 months I asked my self if…
Jonas E.
  • 45
  • 5
1 2
3
9 10