rotation - How to make an object on the screen rotates , in swift -


i creating iphone game in xcode using swift , , there ball want keep rotating , think need update method , how , , if there way out using update method please let me know

you use skaction (take @ documentation; you'll see skactions have variety of uses). rotation do:

// angle measured in radians , duration measured in seconds. let rotateaction = skaction.rotatebyangle(1, duration: 1) 

to make action run forever can use skaction:

let repeataction = skaction.repeatactionforever(rotateaction) 

finally, need make node (ball) run action:

ball.runaction(repeataction) 

take @ sknode documentation other methods can use run skaction.

also, i'm assuming you're new sprite kit, i'd recommend take @ the sprite kit programming guide.


Comments