Fix size of menu scene text and logo

This commit is contained in:
Marcel Schwarz 2020-06-25 20:52:22 +02:00
parent 89dc64db27
commit 4a3d22596a
2 changed files with 61 additions and 59 deletions

View File

@ -9,29 +9,26 @@
import Foundation import Foundation
import GameplayKit import GameplayKit
class SpinningLogoEntity: GKEntity { class SpinningLogoEntity : GKEntity {
let spinningLogoNode : SpinningLogo3DNode let spinningLogoNode: SpinningLogo3DNode
let goldLetteringNode : SKSpriteNode let goldLetteringNode: SKSpriteNode
let warsLetteringNode : SKSpriteNode let warsLetteringNode: SKSpriteNode
init(sceneSize size: CGSize) { init(sceneSize size: CGSize) {
spinningLogoNode = SpinningLogo3DNode()
let midX = size.width / 2
let midY = size.height / 2
goldLetteringNode = SKSpriteNode(texture: SKTexture(imageNamed: "goldLettering")) goldLetteringNode = SKSpriteNode(texture: SKTexture(imageNamed: "goldLettering"))
goldLetteringNode.position = CGPoint(x: midX, y: midY); goldLetteringNode.position = CGPoint(x: size.width / 2 , y: size.height * 0.83)
goldLetteringNode.size = CGSize(width: 675, height: 284) goldLetteringNode.size = CGSize(width: size.width / 2.02, height: size.height / 3.6)
goldLetteringNode.position = CGPoint(x: midX , y: midY + 280);
goldLetteringNode.size = CGSize(width: 675, height: 284)
warsLetteringNode = SKSpriteNode(texture: SKTexture(imageNamed: "warsLettering")) warsLetteringNode = SKSpriteNode(texture: SKTexture(imageNamed: "warsLettering"))
warsLetteringNode.position = CGPoint(x: midX, y: midY - 300); warsLetteringNode.position = CGPoint(x: size.width / 2, y: size.height * 0.17)
warsLetteringNode.size = CGSize(width: 700, height: 284) warsLetteringNode.size = CGSize(width: size.width / 2.02, height: size.height / 3.6)
spinningLogoNode.viewportSize = CGSize(width: 200, height: 200) spinningLogoNode = SpinningLogo3DNode()
spinningLogoNode.viewportSize = CGSize(width: size.width / 5.12 * 0.69, height: size.height / 3.84 * 0.69)
spinningLogoNode.zPosition = goldLetteringNode.zPosition - 1 spinningLogoNode.zPosition = goldLetteringNode.zPosition - 1
spinningLogoNode.position = CGPoint(x: midX - 65, y: midY + 285); spinningLogoNode.position = CGPoint(x: size.width * 0.455, y: size.height * 0.83)
super.init() super.init()
} }

View File

@ -17,7 +17,8 @@ class MenuScene: SKScene {
entityManager.setScene(scene: self) entityManager.setScene(scene: self)
let midX = self.size.width / 2 let midX = self.size.width / 2
let midY = self.size.height / 2 let midY = self.size.height / 2
entityManager.add(Button(name: "startGameButton", entityManager.add(
Button(name: "startGameButton",
textureName: "gold_button_3", textureName: "gold_button_3",
text: "Start Game", text: "Start Game",
position: CGPoint(x: midX, y: midY + 90), position: CGPoint(x: midX, y: midY + 90),
@ -26,41 +27,45 @@ class MenuScene: SKScene {
self.loadScene(scene: GameScene(size: self.size)) self.loadScene(scene: GameScene(size: self.size))
SoundManager.sharedInstance.stopMenuMusic() SoundManager.sharedInstance.stopMenuMusic()
} else { } else {
if GameCenterManager.isAuthenticated { if GameCenterManager.isAuthenticated {
GameCenterManager.sharedInstance.presentMatchmaker() GameCenterManager.sharedInstance.presentMatchmaker()
}else { } else {
GameCenterManager.sharedInstance.authUser() GameCenterManager.sharedInstance.authUser()
} }
} }
})) }
entityManager.add(Button(name: "settingsButton", )
)
entityManager.add(
Button(name: "settingsButton",
textureName: "gold_button_3", textureName: "gold_button_3",
text: "Einstellungen", text: "Einstellungen",
position: CGPoint(x: midX, y: midY ), position: CGPoint(x: midX, y: midY ),
onButtonPress: { onButtonPress: { self.loadScene(scene: SettingsScene(size: self.size))}
let scene = SettingsScene(size: self.size) )
self.loadScene(scene: scene) )
})) entityManager.add(
entityManager.add(Button(name: "gameCenterButton", Button(name: "gameCenterButton",
textureName: "gold_button_3", textureName: "gold_button_3",
text: "GameCenter", text: "GameCenter",
position: CGPoint(x: midX, y: midY - 90), position: CGPoint(x: midX, y: midY - 90),
onButtonPress: { onButtonPress: {
if GameCenterManager.isAuthenticated { if GameCenterManager.isAuthenticated {
GameCenterManager.sharedInstance.presentGameCenter() GameCenterManager.sharedInstance.presentGameCenter()
}else { } else {
GameCenterManager.sharedInstance.authUser() GameCenterManager.sharedInstance.authUser()
} }
})) }
entityManager.add(Button(name: "regelwerkButton", )
)
entityManager.add(
Button(name: "regelwerkButton",
textureName: "questionmark", textureName: "questionmark",
text: "", text: "",
position: CGPoint(x: self.size.width - 50, y: self.size.height - 50), position: CGPoint(x: self.size.width - 50, y: self.size.height - 50),
onButtonPress: { onButtonPress: { self.loadScene(scene: RulesScene(size: self.size)) }
let scene = RulesScene(size: self.size) )
self.loadScene(scene: scene) )
}))
entityManager.add(Background(size: self.size)) entityManager.add(Background(size: self.size))
entityManager.add(SpinningLogoEntity(sceneSize: self.size)) entityManager.add(SpinningLogoEntity(sceneSize: self.size))