SkSpriteNode position in universal game

前端 未结 2 432
甜味超标
甜味超标 2020-12-08 08:42

I\'m creating universal game for all iOS devices in portrait mode using Swift. In GameViewController I\'m creating scene like this:

let scene = GameScene(siz         


        
2条回答
  •  北荒
    北荒 (楼主)
    2020-12-08 09:36

    I don't think this is really the best approach. You should creating the GameScene based on SKView's size

    let scene = GameScene(size: self.skView.bounds.size)
    

    I don't think you should be setting one universal size for every device. You need to let the device set the scenes dimensions based on the screen's resolution. Then you need to be creating different images based on the device. 2x, 3x, 2x~ipad etc..

    This tutorial is a good place to start: http://www.raywenderlich.com/49695/sprite-kit-tutorial-making-a-universal-app-part-1

提交回复
热议问题