SpriteKit - Set Scale and Physics

后端 未结 3 1088
庸人自扰
庸人自扰 2020-12-09 12:38

What is the correct way to \"zoom out\" on your scene.

I have an object that I apply an impulse to fire it across the screen. It for example will fire about 100 px a

3条回答
  •  我在风中等你
    2020-12-09 12:57

    I believe you're not supposed to scale the SKScene (like it hints you if you try setScale method with SKScene). Try resizing it instead.

    myScene.scaleMode = SKSceneScaleModeAspectFill;
    

    And then while zooming:

    myScene.size = CGSizeMake(myScene.size.width + dx, myScene.size.height + dy);
    

    *Apple documentation says:

    Set the scaleMode property to SKSceneScaleModeResizeFill. Sprite Kit automatically resizes the scene so that it always matches the view’s size.

提交回复
热议问题