1
votes

I am having all sorts of trouble trying to get the scene size right.

I am loading a JSTileMap with the following scene size:

SKScene * scene = [GameLevelScene sceneWithSize:skView.bounds.size];
scene.scaleMode = SKSceneScaleModeAspectFill;

The tiles appear twice the size (too large).

skview.bounds.size

If I set the scene size specifically:

SKScene * scene = [GameScene sceneWithSize:CGSizeMake(1136, 640)];
scene.scaleMode = SKSceneScaleModeAspectFill;

CGSizeMake(1136,640)

The tiles appear in the correct size. I am using an iPhone 5 for the simulator device. I want to be able to resize the scene for any device not just the iPhone 5. I thought the first method would solve this but it doesn't?? Why is this happening?

1
do you present the scene in viewDidLoad?LearnCocos2D
I present the scene in: ViewDidAppear. I am not using ViewDidLoad.TazmanNZL
I have tried all three different methods: viewDidLoad , viewDidAppear, viewWillAppear. All do the same thing.TazmanNZL
When using skView.bounds.size and checking the scene size it is exactly half the expected size: 568,320 instead of 1136,640TazmanNZL
that's the size in points, all positioning in sk and uikit happens in points to better support the high density retina displaysLearnCocos2D

1 Answers

0
votes

Try adding "@2x" after your tile set(s). This might fix your issue. This basically scales the image twice as much, (i.e. a 200x200 tileset becomes 100x100)