669 questions
- Bountied 0
- Unanswered
- Frequent
- Score
- Trending
- Week
- Month
- Unanswered (my tags)
0
votes
0
answers
48
views
Lag between SKAction and SKAudioNode when SKScene is paused and resumed
Overview
In my SKScene, I have a SKAudioNode playing an audio file, declared as follows:
var backgroundMusic: SKAudioNode?
and initialized like this:
guard let musicURL = Bundle.main.url(...
0
votes
0
answers
67
views
SKAction completion closure error: Escaping closure captures 'inout' parameter
I'm trying to call a function that takes in an Array as a reference
spill(pool: &objectPool)
And the function will make the array pops its first element to run some animations. Once the animation ...
0
votes
0
answers
72
views
Spritekit crashes sporadically on SKAction.move
I'm developing an app that moves a "grid" with Spritekit SKAction.move, based on frequent updates from ARKit. It crashes sporadically at camera?.run(moveToAction). Sometimes the app runs for ...
1
vote
1
answer
86
views
is it okay to call a run SKAction method inside of the update function?
I am running the SKAction.rotate(to:) method on an SkspriteNode to animate the sprite's rotation. It works alright calling it whenever I need it to point towards a new location, however it rotates in ...
0
votes
1
answer
133
views
How to pause a timer run through SKAction in SpriteKit
In my game built on SpriteKit the player has a set amount of time to complete each level, and on expiration either a game over method or a next level one is called.
Since I know that using NSTimer ...
0
votes
0
answers
133
views
How to create a "Slither" action in a SpriteKit Snake game?
I am trying to make a Snake game in SpriteKit. I thought this would be super easy to do, while utilising all of SpriteKit's SKAction features such as timing modes, sequences, groups, etc. However, I ...
1
vote
1
answer
187
views
How to implement a Move action in SpriteKit
SpriteKit has an action called .moveBy(x:y:duration:). I wanted to try and implement this action myself and found it surprisingly difficult.
static func moveX(by amount: CGFloat, duration: ...
1
vote
1
answer
87
views
How do SKActions change node properties without calling its setter in SpriteKit?
In the documentation for SpriteKit, I found this:
Generally, actions do not call public methods on nodes. For example, if you want to subclass SKNode to respond to a move(to:duration:) action, you ...
-1
votes
1
answer
54
views
Swift loop runs in reverse? Code conundrum
I don't understand what is happening in this code...
fileprivate func genericNodeWalker(_ direction:Follow, encapsulatedMethod: @escaping (_ iNode:Int) -> Void) {
switch direction {
case ....
2
votes
1
answer
130
views
Why SKTexture.preload raises memory issue on a real device?
I'm using SpriteKit for a 2D game and have an array of images for a simple animation.
First, I'm creating an array with SKTextures to keep references to those images.
var hyperLeapArray: [SKTexture] ...
0
votes
0
answers
71
views
In SpriteKit how can I have code for tracking the textures of two nodes at a time? As well code to track if all the nodes were matched in time?
I would like to have one piece of code in my app where I can track the textures of two nodes at a time. If the textures of the two nodes don't match I would like them reset back to their original ...
1
vote
1
answer
72
views
Stop SKAction after a certain amount of time
I have a number of enemies that spawn at separate times in my game, and move using SKAction but at the end of each level I have a boss that spawns in. When the boss spawns I want the other enemies to ...
1
vote
0
answers
50
views
Unable to make enemy sprites zig zag and fire back Swift, Spritekit
I'm making a 2D scrolling shooter. I want one of the enemies to move randomly has they move down the the screen or in a zig zag kinda movement. The enemy pause's for half a second and at this point I ...
0
votes
1
answer
30
views
Adding SKShapeNodes - using while loop blanks UI
I have a game which is running well but as soon as I introduce a while loop my entire UI goes blank.
I have some code which generates a sprite from an array and moves it down the screen
func ...
2
votes
0
answers
35
views
Does SKNode have an actions property?
I wondered if there was an easy way to see a list of all actions currently assigned to a node in SpriteKit. Something like an "actions" property that will contain a list of all a node's ...