Resize Sprites and Their PhysicsBodies for same experience across all devices.

Fairly new to SpriteKit and was trying to create a simple game involving controlling a character to avoid objects being dropped from the top of the screen (iphone only).


Currently my game is easier on devices with larger screen sizes as my sprites and their physics bodies don't scale based on the screen size.

I was wondering what would be the best way to go about scaling all of my sprites based on their screen size.


I've tried scaling the SpriteNodes appearance and physics bodies based on the "self.view.bounds.height / 736" as I saw on several articles and other online postings. That resized the sprites correctly but messed up the different impulses and movements I applied to the character node as each sprite now had a different size and weight due to its physics bodies changing to scale for each screen.


How would I go about rescaling my sprites and the physics affecting them so that the game plays the same across all different types of devices (i.e. easier on iPhone 6+ and more difficult on iPhone 4).


Thank you!

Did you ever figured this out? I'm having the same problem and googling is of little help

Well, the problem is that if the sprites are the same physical size on different screens, then they have different amounts of space to move around in. That's also going to change the nature of the gameplay, as objects hit each other or the edges of the screen sooner.


Still, if you want them to be the same size, the correct solution is to change the scaling mode of the SKScene. The template Sprite Kit project that you likely started from sets the scaling mode to "aspect fill". (This is done in the scene's view's view controller, IIRC.) To get an absolute size for your objects, use one of the non-scaling modes for the scene, which means the scene bounds will vary according to the device. You'll then have to lay out your game geometry within the screen size you're working with.


If your game world is larger than the screen (i.e. it scrolls), then you'd use the same approach, but set the scene size to something bigger than the screen size, and move the scene around relative to the screen by adjusting its anchor point, for example.


There are other approaches, such as simulating scrolling instead, but your choice of solutions is going to depend on the nature of your game.

Resize Sprites and Their PhysicsBodies for same experience across all devices.
 
 
Q