Spritekit scale full game to iPad

So I'm developing a game on Xcode using Spritekit, for the iPhone. And it looks all the same and great on all iPhone devices, by using the node.setScale() method. Now I want to make it Universal and runnable on the iPad as well. How do I do this easi...
more »

2017-02-19 23:02 (2) Answers

How to make SKSpriteNode fall at a downward curve

What I have Now: The node currently only travels in a straight line on the x-axis. let actionBomb = SKAction.repeatForever(SKAction.moveTo(x: 495, duration: 3.0)) What I’m looking to achieve: The goal is to have the node travel at a downward c...
more »

2017-02-17 09:02 (1) Answers

Colorising a Sprite with a Texture Doesn't Work

I'm trying to make game sprites flash a colour when they are damaged with the colour quickly fading back to normal. All the sprites have bitmapped textures but they are not affected by the command. I tried the same on a SpriteNode with a plain colour...
more »

2017-02-14 11:02 (1) Answers

How to make text appear on button? -SpriteKit

I am new to SpriteKit, and I am creating a game where I have designed the main menu with sketch and apply the image to spritekit as my background image. Everytime I put a label/text above the button images. It doesn't work properly. When they tap on ...
more »

2017-02-11 23:02 (1) Answers

Swift 3 my game over code doesn't work correctly

Sorry! the problem is not that what I thought the first time. So when I touch the first time the right button it's work than when I touch another button no matter if that is the right button or not it's print out game over and reset the score to 0. B...
more »

2017-02-11 19:02 (3) Answers

Spritekit Disable Touch on Certain Area of View

New coder here, I made a code for dragging/throwing an object and I wanted to know how to make it so that only part of the screen can be used for touch, i.e. only the bottom half of the screen can be touched. This is my gamescene code, and I'm using ...
more »

2017-02-08 23:02 (2) Answers

Shader not laying on top of my sprite

I'm trying to understand how to apply shaders in SpriteKit, so I made the following shader that comes from a guide with some adaptations (http://battleofbrothers.com/sirryan/understanding-shaders-in-spritekit): void main() { vec4 val = texture2D...
more »

2017-02-08 13:02 (1) Answers

How to remove a SKSpriteNode correctly

I'm doing a small game in Swift 3 and SpriteKit. I want to do a collision with my character and a special object that increases my score in 1, but for some reason, when I detect the collision, the score increases in 2 or 3. I'm removing from parent...
more »

2017-02-07 17:02 (1) Answers

Why is my SKShapeNode(s) reversed?

I'm training my SpritKit skills, but I can't figure out why my SKShapeNode are "reversed", I think I'm missing something. I was trying example from this question: Question So, I tried the example with 2 rounded corners, and another example which is...
more »

2017-02-06 00:02 (0) Answers

Core Image NSException Crash, why/what?

In SpriteKit, using an Effect node, I apply a simple gradient to a simple rectangle. That seems to work fine, however adding it to the scene causes a NSException. PLEASE: What am I doing wrong? import SpriteKit import GameplayKit import CoreIma...
more »

2017-02-04 19:02 (2) Answers

Segue between SKScene and UIViewController

I'm writing simple math game with swift 3 and I have a problem with segues. I have two GameViewController's, oneUIViewController and one NavigationViewController. I want to make two menus, one with game modes and one with difficulties, I want that ...
more »

2017-02-03 23:02 (0) Answers

SKSpriteNode creates a thin coloured line

So I am using 3 SKSpriteNode's in my application. floorSprite, leftWall and rightWall. This is the code I am currently using: let floorSprite = SKSpriteNode()//(imageNamed: "floor") floorSprite.alpha = 0.0 floorSprite.anchorPoint = CGPo...
more »

2017-01-31 22:01 (1) Answers

Overlay SKScene on SKScene

Yes, I know what you're thinking... but this is not a duplicate.. I have 2 scenes, gameScene and menuScene. I want to overlay the menuScene over the gameScene. I know you can't present 2 scenes at once and I looked at solutions, they all suggest set...
more »

2017-01-31 19:01 (2) Answers

Simple coordinate locations

I am using Xcode, sprite kit, swift. I have a very simple problem. I use the following code to set an object in the following position: CGPoint(x: world.frame.size.width / 2, y: world.frame.size.height / 2 * 1.6) I now want to place another objec...
more »

2017-01-31 13:01 (1) Answers

Handling Multiple GestureRecognizers

I've run into an issue understanding UIGestureRecognizers. My goal right now is to have a set of GestureRecognizers to do different tasks, for example: override func viewDidLoad() { mainScene = GameScene(size: self.view.bounds.size) main = v...
more »

2017-01-29 07:01 (1) Answers

Dismissing GameScene in swift 3

I'm making a simple pong game with Swift in SpriteKit. I'm new to SpriteKit so I can't yet solve my problem. I have menu UIViewController, GameViewController and a UINavigationController to switch between them: Everything is OK but when one of t...
more »

2017-01-28 12:01 (0) Answers

How to store value globally?

The code will store the x1 and y1 variables, but they revert back to their original 0.0 value as soon as the touchesEnded function begins. I want these values to remain after the touchesBegan function ends. How can I store these values? var x1: CGF...
more »

2017-01-27 06:01 (3) Answers

Swift Timer Check TouchesEnded

Sorry to be awkward but please can I have the full code on how to do this: I would like a delay of 1 second after every bullet is shot in my game to prevent bullet spam. If possible without creating a separate function for the bullet spawning as I h...
more »

2017-01-26 21:01 (1) Answers

Add a delay to a function in SpriteKit

I would like to be able to only allow the player to shoot a missile every 0.7 seconds. How do I do this? Here is my code. I have tried other methods I found on this site but they do not work. func fireTorpedo() { if !self.player.isPaused { ...
more »

2017-01-26 20:01 (3) Answers