Jennifer
Jennifer

Reputation: 1852

Unable to set the right size for the GameScene in spritekit [SWIFT]

Currently I'm making a game in spritekit & swift but the problem is I've set the GameScene size with size:CGSize(width: 750, height: 1334) in GameViewController that extends the UIViewController.

The reason that I had set the size to 750 * 1334 is because I wanted to publish the game for iphone 6, but the problem is the will it be displayed wrongly in 6plus or iphone 5 ? Was it the right choice to set the size ?

Should I prepare the image for @2x and @3x ? Most of the ingame characters and images are set with 150 * 150 and it is well suited for the 750 * 1334 environment but should I set other resources? I fear if I submit my game it will be rejected . I would love to hear from the pros here !

Upvotes: 1

Views: 516

Answers (1)

Kelvin Lau
Kelvin Lau

Reputation: 6781

Setting the size to a particular value will definitely have implications on different devices. For example, if you test on an iPad, you'll likely find that some parts of the view visible that isn't visible on your iPhone 6 device. I know you didn't say you're supporting the iPad, but I just wanted to point out the fact that you'll get different gaming experiences for different screen sizes if you hard code the size.

That being said, depending on how the gameplay is, the extra space might not impact the gameplay at all. For instance, if the edge of your game screen consists of background imagery that doesn't contribute to overall gameplay, I think hard coding the size of the GameScene can be acceptable if all you cut off is the background imagery.

Anyhow, to avoid this inconsistency, I suggest you try setting the size as view.bounds.width and view.bounds.height respectively, which will guarantee your screen spans the full size of your device's screen. This isn't the solution for all games as it may cause scaling issues, but check it out and see how it looks on different devices.

Scaling the image for @2x and @3x is not hard, you should definitely put in time to do that.

Upvotes: 1

Related Questions