Swift & SpriteKit - switch statement using break

I have a switch statement that that determines which node name was touched. I have two nodes that overlap. If the top one is touched, I want only the code for the top node case to be executed. So I put a break after that case. Even so, the code for b...
more »

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

Movement while screen/control is touched

Having learned the basics of SpriteKit I am wondering how to implement this simple control mechanism: Applying force to/moving a node while a view/node/control is held. I can only find methods applying force once. ...
more »

2017-08-10 19:08 (1) Answers

Make player double jump Sprite Kit Swift

I have implemented a single jump for my player. But I want the player to be able to double jump if the user taps twice. How do I make this function below check to see if the jump is still in duration, so that they can tap and jump again if they want...
more »

2017-08-09 20:08 (1) Answers

Swift code crashing and not working

After adding code into my update(_ currentTime: TimeInterval) function, my app's code continues to crash. Is there a better way to express my code so it doesn't crash? import SpriteKit import GameplayKit class GameScene: SKScene { var startScreen ...
more »

2017-08-08 12:08 (3) Answers

How can I bend a rectangle in sprite kit

let's imagine I have a SKSprite node. for reference, I will give an example: let rect = SKSpriteNode(color: UIColor.blue, size: CGSize(width: 50, height: 300)) rect.position.x = self.frame.midX rect.position.y = self.frame.midY self.addChild(rect) ...
more »

2017-08-01 18:08 (1) Answers

Node automatically move in random direction

I'm trying to create a ball that automatically moves forward in a random direction once it is created. I've tried creating a random angle from 0-360 and having the node rotate and then having an impulse applied to the node, but the node simply stays ...
more »

2017-07-13 07:07 (1) Answers

How to solve Leaks?

So I have memory leaks in my game. I think its coming from Admob and game center integration. Any suggestion for tackling this problem? I tried locating the problem using leak instrument but I have no idea how to do that. Also is it worth solving the...
more »

2017-07-09 05:07 (1) Answers

iOS SpriteKit - Outline SKLabel Font (SKShader)

I am currently learning the SKEffect+SKShader from SpriteKit to apply gradient color on SKLabels, and I was wondering if there is a way to outline the font as well. Like this: Image Currently, I'm using this code which is doing just okish, but this...
more »

2017-07-07 11:07 (0) Answers

Optimize Swift Game Textures and Animations

At first my Swift 3.0 IOS game ran at about 55-60 FPS which seemed to be alright, but as the game has increased in size over time the FPS have began to drop. Currently I am seeing the game drop to about 30.0 FPS quickly after beginning. Currently a...
more »

2017-07-04 19:07 (0) Answers

Swift Sprite Nodes Colliding

I want to enable two SKSpriteNodes to pass through one another. From my understanding the following code should do the trick: beam?.physicsBody = SKPhysicsBody(rectangleOf: CGSize(width: beam!.size.width - 40, height: beam!.size.height/4));...
more »

2017-06-30 01:06 (0) Answers

Detecting Touch and hold on screen IPhone (Xcode)

Im trying to find out how to detect a touch&hold on screen method in the game im making. Im using touches began for single taps (Making the character move up) When they touch and keep holding i want the character to move straight forward. - (voi...
more »

2017-06-19 13:06 (2) Answers

Create dashed line in SpriteKit (OS X)

I'm trying to create a dashed line using an SKShapeNode in SpriteKit for Mac OS X in Objective C, not iOS and not in Swift. I've taken a look at many SO articles for this and tried to piece it together. The main issue that a lot of them are in Swift....
more »

2017-06-17 20:06 (0) Answers

detecting if a spritenode exists in swift

I am trying to detect if one of the nodes that I have made through a subclass of SKNode (called Achievements) exists and if it doesn't exist then i'm trying to turn off a boolean variable. What I use to locate the SKShapeNode (called "Indicator") ...
more »

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

SpriteKit Actions.sks file need to preload?

I created an Actions.sks file for my game. I've noticed that the first time one of the actions from the file is executed my game glitch's a little bit. Example: My player comes in contact with a specific block, and that is when it happens. It is a 2...
more »

2017-06-13 23:06 (0) Answers

Font is being ignored when app is built?

So I have just finished making a game (with help from @Fluidity) and when I build it the fonts requested are all ignored. I have selected fonts to be used in main.storyboard but when it gets to the game the default is used. Any help is appreciated. ...
more »

2017-06-12 19:06 (2) Answers

GameScene.sks and GameScene.swift

Having issues with the GameScene.sks and GameScene.swift. I was attempting to add a title screen to my project and it went downhill from there. The title screen works fine but the issue is when I edit the Gameviewcontroller.swift. This is how I wan...
more »

2017-05-23 01:05 (1) Answers