Stephen Haney

Camera Shake with SpriteKit in Swift

Previously, we’ve covered using a master SKSpriteNode called ‘world’ to gather all of our game sprites on one parent sprite node. This allows us to move the entire ‘camera’ of our game by simply moving around this one sprite node. Now let’s apply a solid camera shake on important game events.

Positioning SKSprites in SpriteKit with
SKScene scaleMode

I quickly ran into a snag upon firing up a new Xcode SpriteKit project and attaching a few test SKSpriteNodes to my SKScene. None of my dummy sprites were showing up at the size or location I anticipated! After a bit of web searching I realized that SKScenes are automatically scaled based on the screen size of the device. I can see how this is pretty handy, but it’s the kind of thing I like to make sure I get right early in the dev process. Here’s how I created a consistent positioning and sizing system I can trust.