Questions tagged [skaction]

Questions about programming SKAction objects in Apple's SpriteKit graphics rendering and animation framework.

Use this tag for questions about programming SKAction objects in Apple's graphics rendering and animation framework.

An SKAction changes a node property over time. It can also run custom blocks and it can be run on individual particles of an SKEmitterNode. Multiple actions can be run in parallel or sequence.

Actions are evaluated after the SKScene's update method. The scene receives the didEvaluateActions message when actions have been evaluated for the current frame.

Note: actions override physics behavior, for example a node with physicsBody that runs a SKMove action will not stop at collisions.

Click Here for Apple Docs.

667 questions
8
votes
2 answers

Skaction.playsoundfilenamed crashes when repeat - sprite kit

I have a problem with sprite kit SKAction.playSoundFileNamed. In practice, after some time it is played correctly , the app crashes saying it will not load . The file is included in the bundle import the project file exists and everything is…
Mr. Developer
  • 3,295
  • 7
  • 43
  • 110
8
votes
1 answer

How to assign Keys to SKActions in Swift

I was hoping someone would be able to help me with this problem. I can't seem to find a way to assign a key to an SKAction for Sprite Kit for the removeActionWithKey method. I have also tried assinging the action to a key in a dictionary but the…
user3846167
  • 81
  • 1
  • 2
8
votes
5 answers

Know when all SKActions are complete or there aren't any running

I have a number of SKActions running on various nodes. How can I know when they are all completed? I want to ignore touches while animations are running. If I could somehow run actions in parallel on a number of nodes, I could wait for a final…
ahwulf
  • 2,584
  • 15
  • 29
8
votes
3 answers

How do you move an IOS SKSprite at a consistent speed

Playing around with SKSprites in the IOS SpriteKit, and I basically want to have a sprite randomly move a certain direction for a certain distance, then pick a new random direction and distance.. Simple enough, create a method that generates the…
Speckpgh
  • 3,332
  • 1
  • 28
  • 46
8
votes
2 answers

checking if an SKNode is running a SKAction

How can I check whether a SKNode is already running an action before running an action on it? I want to be able to do something like... if (![mySprite isRunningActions]) { [mySprite runAction:action]; } If there is no built in way I'm thinking…
user2796283
  • 273
  • 4
  • 8
7
votes
3 answers

Completion block never called at end of SKAction sequence of groups

Why is the completion never called? I'm terribly sorry about this, a code dump... because I have no idea why every part of this works, except for the calling of the completion. The SKAction that's not calling its completion runs, all except for the…
Confused
  • 6,048
  • 6
  • 34
  • 75
7
votes
1 answer

SpriteKit - Create random objects and move them using deltatime

In my game I want to call a function every few seconds that creates random objects from an array. Currently I'm moving this objects by SKAction like this: func createRandmoObject() { let random = arc4random_uniform(4) randomObject =…
Abdou023
  • 1,654
  • 2
  • 24
  • 45
7
votes
4 answers

Rotate sprite by touch with a limited rotation speed

I'm trying to make my spriteNode rotate over finger touch. So far I can do it, but what I want is that my node have a "rotation speed". So I calculate the length of the angle then set a different timing to rotate with it (if the arc is long, it will…
Tancrede Chazallet
  • 7,035
  • 6
  • 41
  • 62
7
votes
1 answer

SKAction change the color of a SKShapeNode

I am using the repeatActionForever method from SKAction to change the color of an SKShapeNode. Here's my code: SKShapeNode *ship = [SKShapeNode node]; [ship setPath:CGPathCreateWithRoundedRect(CGRectMake(-15, -15, 40, 17), 6.25, 6.25,…
raej2010
  • 117
  • 2
  • 9
6
votes
1 answer

How to interrupt a SpriteKit sequence of actions and resume as if there was no interruption

I would like to interrupt the sequence below for 2 seconds and resume to where it would have been if it wasn't interrupted in the first place. For example, from the code below, if I were interrupt the sequence for 2 seconds by making the sprite…
ItsMeAgain
  • 595
  • 4
  • 18
6
votes
2 answers

EaseOut action with custom SKAction

I have the following custom SKAction working but as an EaseIn instead EaseOut. I want it to EaseOut! I have failed miserably to correct it using various easing equations found around the web. let duration = 2.0 let initialX =…
shahidaltaf
  • 585
  • 1
  • 5
  • 17
6
votes
1 answer

How to move enemy towards a moving player?

I am creating a simple sprite kit game that will position a player on the left side of the screen, while enemies approach from the right. Since the player can be moved up and down, I want the enemies to "smartly" adjust their path towards the…
JimmyJammed
  • 9,598
  • 19
  • 79
  • 146
6
votes
1 answer

How to create action on Xcode action editor

I want to try these new Xcode feature but I don't understand what to do. I first create a new SpriteKit action file. Then action editor open with a text displayed in the middle of the screen: No Preview Scene Selected. So how to "select Scene".…
Dominique Vial
  • 3,729
  • 2
  • 25
  • 45
6
votes
2 answers

Sound resource can not be loaded Swift SKAction

I have an app that plays a sound file every time the screen is touched. For some reason, the app will crash every once in a while with the following error: reason: 'Resource tick.mp3 can not be loaded' In case you need it, here is how I play the…
Reece Kenney
  • 2,734
  • 3
  • 24
  • 57
6
votes
2 answers

Animate Path Drawing in SpriteKit

I'm attempting to animate the drawing of a stroke on a path using SpriteKit. I have implemented a working solution using SKActions and a separate implementation using CABasicAnimations. The SKAction solution is not very elegant; it creates and…
Scott Mielcarski
  • 760
  • 6
  • 17
1
2
3
44 45