Learn iOS SpriteKit with Examples, Code Snippets and Video Tutorials

How to rotate a SKSpriteNode forever!

How to rotate a SKSpriteNode forever!
October 6, 2013 Justin

This is a very simple bit of code here, but I’m sure I’ll forget it myself one day, so for my sake here it goes.

The SKActions are obviously what gets these radar lines rotating, but don’t overlook the anchorPoint property being changes from the default (0.5, 0.5) setting to (0,0) which anchors it in the bottom left of the image. Otherwise it would rotate around the center of the image (the image below should make that clear).

Sprite Kit SKSprite rotating

Justin Dike is the owner and lead developer at CartoonSmart.com. He's taught hundreds of hours of game development video tutorials, covering everything from coding to art. These days he's working mostly on Swift and Sprite Kit tutorials, which often lead into highly polished iOS / tvOS Starter Kits, which require no programming at all, but are capable of making nearly any type game! Yeah, you read that write. You can also find Justin at the official CartoonSmart Podcast


Leave a reply

Check out our premium Swift and Sprite Kit Tutorial content!

Visit CartoonSmart.com