FAQ Database Discussion Community


Extending Array to append SKTextures [duplicate]

ios,swift,sprite-kit,sktexture
This question already has an answer here: Is it possible to make an Array extension in Swift that is restricted to one class? 3 answers Being fairly new to Swift I decided I would look at extending Array (or more specifically [SKTexture] Arrays of SKTexture) with a function to...

SKPhysicsBody uses only part of SKTexture

swift,sprite-kit,skphysicsbody,sktexture
I'm using an SKTexture with an image and set the SKPhysicsBody. Like that: var moleTexture = SKTexture(imageNamed: "moleTop1") leftPlayer = SKSpriteNode(texture: moleTexture) leftPlayer.physicsBody = SKPhysicsBody(texture: moleTexture, size: leftPlayer.texture!.size()) Now after I start my game, I noticed that the physicsBody is set wrong. I've activated the showPhysics property and my image...

Sprite Kit SKTexture animation height unexpectedly changing

ios,animation,sprite-kit,sktexture,sktextureatlas
I am using a SKTextureAtlas to animate a SKSpriteNode. The animation works, but it looks weird because for some reason the sprite's height is changing several times in the animation. This also causes the y position to change as well. Everything else remains the same except for the height and...

Scene Editor: can't specify texture name without @2x

ios,sprite-kit,swift-playground,sktexture
I am setting up a test Sprite Kit Scene file (*.sks) that I plan to use with both the iPhone6 and iPhone6 Plus. I have two versions of my Spaceman art work called: [email protected] (50 x 50 pixels, 25 x 25 points) [email protected] (75 x 75 pixels, 25 x 25...

SpriteKit: How do you highlight a section of the scene, like in a tutorial?

sprite-kit,skspritenode,sktexture
I'm trying to create a tutorial in a game, that goes through parts of the UI and highlights them, whilst dimming the rest of the scene. I think I can do it with Sprites and SKBlendMode, but these are poorly explained in the apple reference guide. Any idea?...

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

ios,swift,protocols,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 there were some main...