In my game, I need to do some setting changes after my SKSpriteNode
stops moving.
First,
I apply force on my SKSpriteNode
, so it starts moving due to the force acting on it.
Now, i need to know when it stops moving.
I know that SKSpriteNode
has a speed
property, but it is always set to 1.0 by default.
Any ideas?
Since you are using physics you can use the resting
property of SKPhysicsBody
.
if sprite.physicsBody?.resting == true {
println("The sprite is resting")
} else {
println("The sprite is moving")
}
Hope this helps.