Skip to main content
OverflowAI is here! AI power for your Stack Overflow for Teams knowledge community. Learn more

Questions tagged [sprite-kit]

SpriteKit is a framework for making 2D games that comes built-in to iOS 7. It has sprite support, support for special effects like videos, filters, and masking, an integrated physics library, and a lot more.

Filter by
Sorted by
Tagged with
1 vote
1 answer
119 views

SKAction on SKLabel with array of Strings

I have an SKLabel attached to a parent SKNode and an array of strings: ...
μολὼν.λαβέ's user avatar
1 vote
2 answers
142 views

Boolean array, NAND of [SKSpritenodes]

I'm using spritekit, using on touch to detect what the users has tapped, ie., no collisions, etc. I have an array of sprite nodes which in effect is a multi-state boolean switch for now the user ...
μολὼν.λαβέ's user avatar
1 vote
0 answers
68 views

Displaying sprites causing lag (2D platformer game)

I've made a 2D platformer game. The map is an array and I also have a separate array for entities such as spinning coins and moving enemies. This array is declared like this: ...
Slavik Ribz's user avatar
54 votes
1 answer
2k views

Swiftly turning wheels – The May 2017 Community Challenge

This is my attempt at the May 2017 Community Challenge in Swift, with a chain consisting of rigid links. I took this as an opportunity to learn SpriteKit, Apple's framework for 2D games. At least ...
Martin R's user avatar
  • 23.3k
0 votes
1 answer
3k views

Calling a method only once in an updateScore function in SpriteKit

This works fine, but obviously it's messy and I'm thinking there has to be a better way to do this. Having to constantly remember to flip the bool back is a pain, is there anything else I can do here? ...
GarySabo's user avatar
  • 155
1 vote
0 answers
850 views

Spawning nodes with random time interval in SpriteKit

I want to spawn objects with random time interval (from 1 to 3 seconds). I've wrote this function: ...
artem's user avatar
  • 111
2 votes
0 answers
122 views

didSimulatePhysics to animate a ball, taking 45% of CPU

According to my time profiler this is taking 45% of my cpu usage: have tried to optimize, and someone on stack overflow -- recommended to post here. Time profiler says 99% of the time is spent on the ...
BARCODE's user avatar
  • 21
4 votes
1 answer
489 views

Vertical-scrolling 2D platform game

I am working on a vertical-scrolling 2D platform game using GameplayKit, SpriteKit and I am writing it in Swift 2.0. Today I ...
Simon Kemper's user avatar
3 votes
1 answer
230 views

Creating a class which has a method running every frame

I’m working in Objective-C, SKSpriteKit and am trying to create a class which will work in both OS X and iOS for flexibility. ...
Shuri2060's user avatar
  • 227
5 votes
0 answers
87 views

Moves box in direction of touch, and has wraparound when reaching edge of screen

Part of me thinks that it would be simpler to ditch Apple's move API and just updated position with a timer. I know that's what I did with a JS canvas snake game I built a while ago. But I'm also ...
MCB's user avatar
  • 151
5 votes
2 answers
364 views

Sprite-Kit/Swift game

I was writing a game in Swift and Sprite Kit and it is very simple. It works perfectly other than the fact that it gets a bit laggy sometimes. I'd like to use this experience as both a learning tool, ...
Daniel's user avatar
  • 265
4 votes
1 answer
1k views

Animated Score Amounts for Game

This is a simple class for a label with a score that animates counting up or down. When someone in the game scores points, the numbers count up or down to the new total. Here is an example of what ...
bazola's user avatar
  • 8,569
11 votes
1 answer
182 views

Bedazzling My Bejeweled Animations

I've spent a few days working on the animations for my Bejeweled clone and I am pretty happy with the results so I am posting the code for review. This is the most advanced animation code that I have ...
bazola's user avatar
  • 8,569
2 votes
1 answer
4k views

Subclass SKSpriteNode

I decided to subclass SKSpriteNode for a game test in Swift today and soon realised that it was not as simple as my Objective-C background suggested. After a little ...
fuzzygoat's user avatar
  • 511
4 votes
1 answer
1k views

Dirty but Efficient Texture Atlas in Spritekit

I have spent quite a bit of time trying to optimize the performance of my 2D mining game. After a lot of research, experimentation, and testing, I finally found something very interesting that ...
bazola's user avatar
  • 8,569
7 votes
1 answer
397 views

Multithreading in a 2D Mining Game

I have implemented some basic multithreading in my 2D mining game that I asked about in a previous question. The first part is working out great (creating the initial object instances in the ...
bazola's user avatar
  • 8,569
10 votes
1 answer
193 views

Chunk Loader for 2D Mining Game

I've spent a couple days on my latest project, and I believe that I have achieved a sufficient level of efficiency to post it here for review. The idea of the game is to mine out an "infinite" world ...
bazola's user avatar
  • 8,569
18 votes
0 answers
377 views

Modularizing a Game Scene in Sprite Kit

I am trying to modularize the main SKScene of my strategy game. I am not sure that my approach is correct so I would love to get a review of the following code. ...
bazola's user avatar
  • 8,569
5 votes
1 answer
1k views

Calculating delta in SpriteKit using Swift

I am attempting to learn swift by refactoring one of my old games and I need to rewrite my update method which calculates a delta time. This code works but is ugly. ...
Kyle Decot's user avatar
6 votes
2 answers
465 views

User Interface for Strategy Game

I've been working a strategy game for iOS for a little while, and each time I add functionality to the game model I'm finding myself building a lot of UI code to sync up with it. I believe that my ...
bazola's user avatar
  • 8,569