sprite kit - Scene size in Xcode 6 / SpriteKit / Swift -


I should be really simple stuff in Xcode, I'm trying to add a ghost in this case. And to sit in the bottom left corner:

  var groundTestxture: SKTexture = SKTtexture (imageNamed: "dirt-block") var Ground: SKSpriteNode = SKSpriteNode (texture: a mixture of ground) ground .position = CGPointMake (ground.size.width / 2, Ground size.height / 2) self.addChild (ground)   

It does not show anything, so what I saw is the scenario dimension And self. The frame size.width and the self.frame.size.height are the width of 1024 and the height of 768 are returned, regardless of orientation.

I want to decide it in landscape mode if it makes a difference in answering?

Obviously I remember a very basic idea to set up this scene, if anybody can put light, then it will be very much appreciated. p> Thank you.

You have to edit GameViewController:

viewDidLoad Exclude and everything from super.viewDidLoad ()

overwrite viewWillLayoutSubviews

  override func viewWillLayoutSubviews () {super.viewWillLayoutSubviews () if the view = GameScene.unarchiveFromFile ("GameScene")? GameScene {// Configure Scene Var SkView as self.view SKView skView.showsFPS = true skView.showsNodeCount = true / * Spread kit applies additional customization to improve presentation performance * / skView.ignoresSiblingOrder = True / * set the scale scale to fit the window * / scene. Size = skView.bounds.size scene.scaleMode = .SpectVill skView.presentScene (view)}}   

its In addition you should set the visual size as you can see

  scene.size = skView.bounds.size   

hopefully It helps

There is also a great tutorial where it is explained further: (Chapter 1 or 2)

Comments

Popular posts from this blog

php - PDO bindParam() fatal error -

logging - How can I log both the Request.InputStream and Response.OutputStream traffic in my ASP.NET MVC3 Application for specific Actions? -

java - Why my included JSP file won't get processed correctly? -