2016-11-17 105 views
0

我已經在屏幕上實現了一個遊戲,當玩家輸了時彈出,高度完全在屏幕中間,但圖像延伸到屏幕邊緣,我不希望它做。我希望圖像稍微偏離屏幕。我在下面的屏幕上附加了我的遊戲代碼。高度設置只需要幫助設置寬度。GameOver屏幕位置迅速

gameOverScreen = SKSpriteNode(texture: gameOverScreenTexture) 

    gameOverScreen.position = CGPoint(x: self.frame.midX, y: self.frame.midY) 

    gameOverScreen.size.height = self.frame.height/3 

    gameOverScreen.zPosition = 0 

    self.addChild(gameOverScreen) 

回答

0

管理整理出來。只是改變這一行:

gameOverScreen = SKSpriteNode(texture: gameOverScreenTexture) 

要這樣:

gameOverScreen = SKSpriteNode(texture: gameOverScreenTexture, size: CGSize(width: 600, height: 600))