From e878016e4fa11824c92f70613547979655989103 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Chauntalle=20Schu=CC=88le?= Date: Fri, 19 Jun 2020 02:15:51 +0200 Subject: [PATCH] - added new asset questionmark - added new Scene: RulesScene - added button to menuScene to load RulesScene - finished layout of RulesScene - finished rules of Spielbeschreibung --- GoldWars/GoldWars.xcodeproj/project.pbxproj | 4 + .../Contents.json | 21 ++ .../yellow_questionmark.png | Bin 0 -> 2965 bytes .../GoldWars/Entities/EntityManager.swift | 40 +- GoldWars/GoldWars/RulesScene.swift | 353 ++++++++++++++++++ GoldWars/GoldWars/Scenes/MenuScene.swift | 9 + 6 files changed, 426 insertions(+), 1 deletion(-) create mode 100644 GoldWars/GoldWars/Assets.xcassets/yellow_questionmark.imageset/Contents.json create mode 100644 GoldWars/GoldWars/Assets.xcassets/yellow_questionmark.imageset/yellow_questionmark.png create mode 100644 GoldWars/GoldWars/RulesScene.swift diff --git a/GoldWars/GoldWars.xcodeproj/project.pbxproj b/GoldWars/GoldWars.xcodeproj/project.pbxproj index 2d47daa..f94fd15 100644 --- a/GoldWars/GoldWars.xcodeproj/project.pbxproj +++ b/GoldWars/GoldWars.xcodeproj/project.pbxproj @@ -45,6 +45,7 @@ AB21D7D5246C748A00B09CBA /* MapFactory.swift in Sources */ = {isa = PBXBuildFile; fileRef = AB21D7D4246C748A00B09CBA /* MapFactory.swift */; }; ABA03DA0244BD54F00A66916 /* Base.swift in Sources */ = {isa = PBXBuildFile; fileRef = ABA03D9F244BD54F00A66916 /* Base.swift */; }; ABC0C3732481509300387B8F /* MapUtils.swift in Sources */ = {isa = PBXBuildFile; fileRef = ABC0C3722481509300387B8F /* MapUtils.swift */; }; + AE0C8E2F249BCC2A00996360 /* RulesScene.swift in Sources */ = {isa = PBXBuildFile; fileRef = AE0C8E2E249BCC2A00996360 /* RulesScene.swift */; }; C04783EE2468583F004961FB /* intro-music.mp3 in Resources */ = {isa = PBXBuildFile; fileRef = C04783ED2468583F004961FB /* intro-music.mp3 */; }; C04783F024685995004961FB /* SettingsScene.swift in Sources */ = {isa = PBXBuildFile; fileRef = C04783EF24685995004961FB /* SettingsScene.swift */; }; C05BB9C4247D890C00411249 /* SliderComponent.swift in Sources */ = {isa = PBXBuildFile; fileRef = C05BB9C3247D890C00411249 /* SliderComponent.swift */; }; @@ -109,6 +110,7 @@ AB21D7D4246C748A00B09CBA /* MapFactory.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MapFactory.swift; sourceTree = ""; }; ABA03D9F244BD54F00A66916 /* Base.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Base.swift; sourceTree = ""; }; ABC0C3722481509300387B8F /* MapUtils.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MapUtils.swift; sourceTree = ""; }; + AE0C8E2E249BCC2A00996360 /* RulesScene.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RulesScene.swift; sourceTree = ""; }; C04783ED2468583F004961FB /* intro-music.mp3 */ = {isa = PBXFileReference; lastKnownFileType = audio.mp3; path = "intro-music.mp3"; sourceTree = ""; }; C04783EF24685995004961FB /* SettingsScene.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SettingsScene.swift; sourceTree = ""; }; C05BB9C3247D890C00411249 /* SliderComponent.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = SliderComponent.swift; sourceTree = ""; }; @@ -180,6 +182,7 @@ 9E0E459624796262009817A6 /* GameCenterManager.swift */, C04783EF24685995004961FB /* SettingsScene.swift */, 3EAD889424801B6A0048A10A /* RoundTimer.swift */, + AE0C8E2E249BCC2A00996360 /* RulesScene.swift */, ); path = GoldWars; sourceTree = ""; @@ -412,6 +415,7 @@ C064E9A8246C0EA50022B228 /* LabelNode.swift in Sources */, 3F745DF0246F48FC00CE7375 /* PlayerMoveType.swift in Sources */, 3EAD889524801B6A0048A10A /* RoundTimer.swift in Sources */, + AE0C8E2F249BCC2A00996360 /* RulesScene.swift in Sources */, 3E67854024728368007B9DE4 /* CElements.swift in Sources */, ABA03DA0244BD54F00A66916 /* Base.swift in Sources */, C064E9AC246C151F0022B228 /* Label.swift in Sources */, diff --git a/GoldWars/GoldWars/Assets.xcassets/yellow_questionmark.imageset/Contents.json b/GoldWars/GoldWars/Assets.xcassets/yellow_questionmark.imageset/Contents.json new file mode 100644 index 0000000..8434bf1 --- /dev/null +++ b/GoldWars/GoldWars/Assets.xcassets/yellow_questionmark.imageset/Contents.json @@ -0,0 +1,21 @@ +{ + "images" : [ + { + "filename" : "yellow_questionmark.png", + "idiom" : "universal", + "scale" : "1x" + }, + { + "idiom" : "universal", + "scale" : "2x" + }, + { + "idiom" : "universal", + "scale" : "3x" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/GoldWars/GoldWars/Assets.xcassets/yellow_questionmark.imageset/yellow_questionmark.png b/GoldWars/GoldWars/Assets.xcassets/yellow_questionmark.imageset/yellow_questionmark.png new file mode 100644 index 0000000000000000000000000000000000000000..d973c7f664ca1491e0795cc665ab7fa1cb78741c GIT binary patch literal 2965 zcmZ{mcRbXOAICrEtmDKX$-1*g#+m19pKQ*`%yx*7ku5oAbaX;S$V!+ycQAJ50*{pUN?(%g`RiH8XQ02X5-J?nE-`)@JQpLa^9 ziNv|k-auo}0MMAh{Ktdtd`4i6tT6x(BL)DtBmg)*w{RN(5RL?Z@9yVpJ^)+_E+ScJ zoG<7-O%3&cv;Rg}S5@}8!w_bS(P#Kd&&Vz$48z|-0RU5hu^!sS_w!bvU#886i^FH@ z-4!R8NOBk%+T559ehUZ_O!Z7s*|E+csc`G-5IZjAhbFb#ec<`J2v zPA8jSp4x8M=kmrnzs1UsL=XQ56p7p8Z+pUo)f~z&^domS(PB6cz12%auVdST_rBBUIh**;<~NSBk`_C&4$v&lD+EKO_SOawq8 zu3BA9Mt{up+N4eS)8;ytoSaFOzww)2?jI=gR_wX*TwIoWfmWhv-E{f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@_t@11LMS}4pGj{okZ*fMK}a96S{f-%NyCU1&%5(jb)2;e%y=Y zyaY;L0uE=AYPjk^zsX-vKq_QHUY3sHF7M=e;4M~eVQme1lmp~Wt0UC+%EG*^=+NF8 zbcg-zWW@|g0V;Z^w2Z&S0+x%ZU|n3NCfiM@ND+C$LU3U6WD<=4Eo-dmlZd$MpLK*@ zA}=2-omL0D2OJZz|4cHR!0yiz1~~4xzQRd8y~fz<68bGlk)~Fi-MMxk(k^^&kj#&E zdIS~}YDiawE~R+TJOFHr83A5Tt`e6)#t8boB_hrau5n>phCeDIyk9fiuus6)iuRR^ zY9-4keSkct2ZS`(XnSo6rmV;iZ8tIENc}z<51dFh*^jaej-UUnqG9?DVO}0#-fGxT z?{fhZkP1i{q>2nu)ka=bO;PDQuON|XNF+H=RO^3$z#uO_pXmP&bdMI}&jG+#-(2sd Ht~>re>uX`^ literal 0 HcmV?d00001 diff --git a/GoldWars/GoldWars/Entities/EntityManager.swift b/GoldWars/GoldWars/Entities/EntityManager.swift index 49b0941..3618a80 100644 --- a/GoldWars/GoldWars/Entities/EntityManager.swift +++ b/GoldWars/GoldWars/Entities/EntityManager.swift @@ -15,13 +15,16 @@ class EntityManager { static let gameEMInstance = EntityManager() static let menuEMInstance = EntityManager() static let settingsEMInstance = EntityManager() + static let rulesEMInstance = EntityManager() var entities = Set() var scene: SKScene var isModal: Bool + var isRules: Bool private init() { isModal = false + isRules = false scene = SKScene.init() } @@ -60,8 +63,21 @@ class EntityManager { scene.addChild(hudEntitiy.blockWholeScreenPane) } + if let rulesEntity = entity as? Rules { + scene.addChild(rulesEntity.header) + scene.addChild(rulesEntity.text1) + scene.addChild(rulesEntity.text2) + scene.addChild(rulesEntity.text3) + scene.addChild(rulesEntity.text4) + scene.addChild(rulesEntity.node1) + scene.addChild(rulesEntity.node2) + scene.addChild(rulesEntity.node3) + // scene.addChild(rulesEntity.overlay) + isRules = true + } + if let wayEntity = entity as? Way { - scene.addChild(wayEntity.localWayComponent) + scene.addChild(wayEntity.localWayComponent) } if let spriteNode = entity.component(ofType: DefaultBaseComponent.self) { @@ -359,4 +375,26 @@ class EntityManager { func updateTime(time: String) { getHUD()?.roundTimerLabel.text = time } + + func removeRules(){ + entities.forEach({entity in + if let rules = entity as? Rules { + rules.header.removeFromParent() + rules.text1.removeFromParent() + rules.text2.removeFromParent() + rules.text3.removeFromParent() + rules.text4.removeFromParent() + rules.node1.removeFromParent() + rules.node2.removeFromParent() + rules.node3.removeFromParent() + + if let button = rules.component(ofType: ButtonComponent.self) { + button.buttonNode.removeFromParent() + } + self.remove(rules) + + isRules = false + } + }) + } } diff --git a/GoldWars/GoldWars/RulesScene.swift b/GoldWars/GoldWars/RulesScene.swift new file mode 100644 index 0000000..e23c7f2 --- /dev/null +++ b/GoldWars/GoldWars/RulesScene.swift @@ -0,0 +1,353 @@ +// +// RulesScene.swift +// GoldWars +// +// Created by Chauntalle Schüle on 18.06.20. +// Copyright © 2020 SP2. All rights reserved. +// + +import SpriteKit +import GameplayKit + +class RulesScene: SKScene { + + var entityManager = EntityManager.rulesEMInstance + + override func sceneDidLoad() { + entityManager.setScene(scene: self) + entityManager.add(Button(name: "backToMenuScene", + textureName: "yellow_questionmark", + text: "", + position: CGPoint(x: self.size.width - 50, y: self.size.height - 50), + onButtonPress: { + let scene = MenuScene(size: self.size) + self.loadScene(scene: scene) + })) + entityManager.add(Label(fontnamed: "Courier-Bold", + name: "rulesLabel", + text: "Regelwerk", + fontSize: 90, + fontColor: .black, + position: CGPoint(x: self.size.width * 0.5, y: self.size.height - 100), + horizontalAlignmentMode: .center, + vertikalAligmentMode: .baseline, + isAnimationEnabled: true, + isAnimationInfinite: true) + ) + entityManager.add(Button(name: "Spiel", + textureName: "yellow_button13", + text: "Spiel", + position: CGPoint(x: self.size.width * 0.1, y: self.size.height * 0.5 + 150), + onButtonPress: { + self.entityManager.removeRules() + self.entityManager.add(Rules(rulesScene: self, rulesCategory: .Spielbeschreibung)) + + })) + entityManager.add(Button(name: "Basen", + textureName: "yellow_button13", + text: "Basen", + position: CGPoint(x: self.size.width * 0.1, y: self.size.height * 0.5 + 85), + onButtonPress: { + self.entityManager.removeRules() + self.entityManager.add(Rules(rulesScene: self, rulesCategory: .Basen)) + + })) + entityManager.add(Button(name: "Einheiten", + textureName: "yellow_button13", + text: "Einheiten", + position: CGPoint(x: self.size.width * 0.1, y: self.size.height * 0.5 + 20), + onButtonPress: { + self.entityManager.removeRules() + self.entityManager.add(Rules(rulesScene: self, rulesCategory: .Einheiten)) + + })) + entityManager.add(Button(name: "Spielende", + textureName: "yellow_button13", + text: "Spielende", + position: CGPoint(x: self.size.width * 0.1, y: self.size.height * 0.5 - 45), + onButtonPress: { + self.entityManager.removeRules() + self.entityManager.add(Rules(rulesScene: self, rulesCategory: .Spielende)) + + })) + entityManager.add(Button(name: "Boost", + textureName: "yellow_button13", + text: "Boost", + position: CGPoint(x: self.size.width * 0.1, y: self.size.height * 0.5 - 110), + onButtonPress: { + self.entityManager.removeRules() + self.entityManager.add(Rules(rulesScene: self, rulesCategory: .Boost)) + + })) + entityManager.add(Button(name: "Erfolge", + textureName: "yellow_button13", + text: "Erfolge", + position: CGPoint(x: self.size.width * 0.1, y: self.size.height * 0.5 - 175), + onButtonPress: { + self.entityManager.removeRules() + self.entityManager.add(Rules(rulesScene: self, rulesCategory: .Achievements)) + + })) + entityManager.add(Background(size: self.size)) + entityManager.add(Rules(rulesScene: self, rulesCategory: .Basen)) + } + + func loadScene(scene: SKScene) { + let transition = SKTransition.flipVertical(withDuration: 0.5) + entityManager.entities.removeAll() + self.view?.presentScene(scene, transition: transition) + } + + override func update(_ currentTime: TimeInterval) { + if entityManager.entities.count != 0 { + entityManager.getBackground()!.update(deltaTime: currentTime) + } + } +} + + +enum RulesCategory: String{ + case Spielbeschreibung + case Basen + case Spielende + case Achievements + case Einheiten + case Boost +} + +class Rules: GKEntity { + + var entityManager = EntityManager.menuEMInstance + //var rulesCategory: RulesCategory + + var header: SKLabelNode + var text1: SKLabelNode + var text2: SKLabelNode + var text3: SKLabelNode + var text4: SKLabelNode + var node1: SKSpriteNode + var node2: SKSpriteNode + var node3: SKSpriteNode + + init(rulesScene: RulesScene, rulesCategory: RulesCategory) { + + switch rulesCategory { + case .Spielbeschreibung: + header = SKLabelNode(text: "Kurze Spielbeschreibung:") + + text1 = SKLabelNode(text: "GoldWars ist ein strategisches, rundenbasiertes Kampfspiel.\nZwei Spieler treten gegeneinander an und versuchen ihre Basen zu erweitern. Dazu schickst du Einheiten auf eine neue Basis.") + text1.position = CGPoint(x: rulesScene.size.width * 0.5 + 50, y: rulesScene.size.height * 0.6 - 20) + text1.numberOfLines = 4 + text1.preferredMaxLayoutWidth = 750 + + let texture = SKTexture(imageNamed:"yellow_boxTick") + node1 = SKSpriteNode(texture: texture, size: CGSize(width: 30.0, height: 30.0) ) + node1.position = CGPoint(x: rulesScene.size.width * 0.5 - 200, y: rulesScene.size.height * 0.6 - 100) + node1.zPosition = 4 + + text2 = SKLabelNode(text: "30 Sekunden Zeit pro Runde") + text2.position = CGPoint(x: rulesScene.size.width * 0.5 + 25, y: rulesScene.size.height * 0.6 - 110) + + node2 = SKSpriteNode(texture: texture, size: CGSize(width: 30.0, height: 30.0) ) + node2.position = CGPoint(x: rulesScene.size.width * 0.5 - 200, y: rulesScene.size.height * 0.6 - 160) + node2.zPosition = 4 + + text3 = SKLabelNode(text: "20 Runden") + text3.position = CGPoint(x: rulesScene.size.width * 0.5 - 100, y: rulesScene.size.height * 0.6 - 170) + + node3 = SKSpriteNode(texture: texture, size: CGSize(width: 30.0, height: 30.0) ) + node3.position = CGPoint(x: rulesScene.size.width * 0.5 - 200, y: rulesScene.size.height * 0.6 - 220) + node3.zPosition = 4 + + text4 = SKLabelNode(text: "Nach jeder Runde kämpfen die\ngegnerischen Einheiten gegeneinander.\nWer die Basis eingenommen hat siehst\ndu an der Farbe der Basis.") + text4.position = CGPoint(x: rulesScene.size.width * 0.5 + 115, y: rulesScene.size.height * 0.2 + 10) + text4.numberOfLines = 4 + + case .Basen: + header = SKLabelNode(text: "Erklärung der Basen:") + + text1 = SKLabelNode(text: "Initialisierung") + self.text1.position = CGPoint(x: rulesScene.size.width * 0.5 - 300 , y: rulesScene.size.height * 0.8 - 100) + self.text1.numberOfLines = 2 + self.text1.preferredMaxLayoutWidth = 390 + + let texture = SKTexture(imageNamed:"yellow_boxTick") + node1 = SKSpriteNode(texture: texture, size: texture.size()) + node1.setScale(2.4) + node1.position = CGPoint(x: rulesScene.size.width * 0.5 - 200, y: rulesScene.size.height * 0.6 - 100) + node1.zPosition = 4 + + text2 = SKLabelNode(text: "30 Sekunden Zeit pro Runde") + self.text2.position = CGPoint(x: rulesScene.size.width * 0.5 - 220, y: rulesScene.size.height * 0.8 - 100) + + node2 = SKSpriteNode(texture: texture, size: CGSize(width: 30.0, height: 30.0) ) + node2.position = CGPoint(x: rulesScene.size.width * 0.5 - 200, y: rulesScene.size.height * 0.6 - 100) + node2.zPosition = 4 + + text3 = SKLabelNode(text: "30 Sekunden Zeit pro Runde") + text3.position = CGPoint(x: rulesScene.size.width * 0.5 + 25, y: rulesScene.size.height * 0.6 - 110) + + node3 = SKSpriteNode(texture: texture, size: CGSize(width: 30.0, height: 30.0) ) + node3.position = CGPoint(x: rulesScene.size.width * 0.5 - 200, y: rulesScene.size.height * 0.6 - 160) + node3.zPosition = 4 + + text4 = SKLabelNode(text: "20 Runden") + text4.position = CGPoint(x: rulesScene.size.width * 0.5 - 100, y: rulesScene.size.height * 0.6 - 170) + + case .Spielende: + header = SKLabelNode(text: "Erklärung des Spielendes:") + text1 = SKLabelNode(text: "Initialisierung") + self.text1.position = CGPoint(x: rulesScene.size.width * 0.5 - 300 , y: rulesScene.size.height * 0.8 - 100) + self.text1.numberOfLines = 2 + self.text1.preferredMaxLayoutWidth = 390 + + let texture = SKTexture(imageNamed:"yellow_boxTick") + node1 = SKSpriteNode(texture: texture, size: texture.size()) + node1.setScale(2.4) + node1.position = CGPoint(x: rulesScene.size.width * 0.5 - 200, y: rulesScene.size.height * 0.6 - 100) + node1.zPosition = 4 + + text2 = SKLabelNode(text: "wtf") + self.text2.position = CGPoint(x: rulesScene.size.width * 0.5 , y: rulesScene.size.height * 0.8 - 500) + + node2 = SKSpriteNode(texture: texture, size: CGSize(width: 30.0, height: 30.0) ) + node2.position = CGPoint(x: rulesScene.size.width * 0.5 - 200, y: rulesScene.size.height * 0.6 - 100) + node2.zPosition = 4 + + text3 = SKLabelNode(text: "30 Sekunden Zeit pro Runde") + text3.position = CGPoint(x: rulesScene.size.width * 0.5 + 25, y: rulesScene.size.height * 0.6 - 110) + + node3 = SKSpriteNode(texture: texture, size: CGSize(width: 30.0, height: 30.0) ) + node3.position = CGPoint(x: rulesScene.size.width * 0.5 - 200, y: rulesScene.size.height * 0.6 - 160) + node3.zPosition = 4 + + text4 = SKLabelNode(text: "20 Runden") + text4.position = CGPoint(x: rulesScene.size.width * 0.5 - 100, y: rulesScene.size.height * 0.6 - 170) + + case .Achievements: + header = SKLabelNode(text: "Erklärung der Achievements:") + text1 = SKLabelNode(text: "Initialisierung") + self.text1.position = CGPoint(x: rulesScene.size.width * 0.5 - 300 , y: rulesScene.size.height * 0.8 - 100) + self.text1.numberOfLines = 2 + self.text1.preferredMaxLayoutWidth = 390 + + let texture = SKTexture(imageNamed:"yellow_boxTick") + node1 = SKSpriteNode(texture: texture, size: texture.size()) + node1.setScale(2.4) + node1.position = CGPoint(x: rulesScene.size.width * 0.5 - 200, y: rulesScene.size.height * 0.6 - 100) + node1.zPosition = 4 + + text2 = SKLabelNode(text: "wtf") + self.text2.position = CGPoint(x: rulesScene.size.width * 0.5 , y: rulesScene.size.height * 0.8 - 500) + + node2 = SKSpriteNode(texture: texture, size: CGSize(width: 30.0, height: 30.0) ) + node2.position = CGPoint(x: rulesScene.size.width * 0.5 - 200, y: rulesScene.size.height * 0.6 - 100) + node2.zPosition = 4 + + text3 = SKLabelNode(text: "30 Sekunden Zeit pro Runde") + text3.position = CGPoint(x: rulesScene.size.width * 0.5 + 25, y: rulesScene.size.height * 0.6 - 110) + + node3 = SKSpriteNode(texture: texture, size: CGSize(width: 30.0, height: 30.0) ) + node3.position = CGPoint(x: rulesScene.size.width * 0.5 - 200, y: rulesScene.size.height * 0.6 - 160) + node3.zPosition = 4 + + text4 = SKLabelNode(text: "20 Runden") + text4.position = CGPoint(x: rulesScene.size.width * 0.5 - 100, y: rulesScene.size.height * 0.6 - 170) + + case .Einheiten: + header = SKLabelNode(text: "Erklärung der Einheiten:") + text1 = SKLabelNode(text: "Initialisierung") + self.text1.position = CGPoint(x: rulesScene.size.width * 0.5 - 300 , y: rulesScene.size.height * 0.8 - 100) + self.text1.numberOfLines = 2 + self.text1.preferredMaxLayoutWidth = 390 + + let texture = SKTexture(imageNamed:"yellow_boxTick") + node1 = SKSpriteNode(texture: texture, size: texture.size()) + node1.setScale(2.4) + node1.position = CGPoint(x: rulesScene.size.width * 0.5 - 200, y: rulesScene.size.height * 0.6 - 100) + node1.zPosition = 4 + + text2 = SKLabelNode(text: "wtf") + self.text2.position = CGPoint(x: rulesScene.size.width * 0.5 , y: rulesScene.size.height * 0.8 - 500) + + node2 = SKSpriteNode(texture: texture, size: CGSize(width: 30.0, height: 30.0) ) + node2.position = CGPoint(x: rulesScene.size.width * 0.5 - 200, y: rulesScene.size.height * 0.6 - 100) + node2.zPosition = 4 + + text3 = SKLabelNode(text: "30 Sekunden Zeit pro Runde") + text3.position = CGPoint(x: rulesScene.size.width * 0.5 + 25, y: rulesScene.size.height * 0.6 - 110) + + node3 = SKSpriteNode(texture: texture, size: CGSize(width: 30.0, height: 30.0) ) + node3.position = CGPoint(x: rulesScene.size.width * 0.5 - 200, y: rulesScene.size.height * 0.6 - 160) + node3.zPosition = 4 + + text4 = SKLabelNode(text: "20 Runden") + text4.position = CGPoint(x: rulesScene.size.width * 0.5 - 100, y: rulesScene.size.height * 0.6 - 170) + + case .Boost: + header = SKLabelNode(text: "Erklärung der Boosts:") + text1 = SKLabelNode(text: "Initialisierung") + self.text1.position = CGPoint(x: rulesScene.size.width * 0.5 - 300 , y: rulesScene.size.height * 0.8 - 100) + self.text1.numberOfLines = 2 + self.text1.preferredMaxLayoutWidth = 390 + + let texture = SKTexture(imageNamed:"yellow_boxTick") + node1 = SKSpriteNode(texture: texture, size: CGSize(width: 5.0, height: 5.0)) + node1.position = CGPoint(x: rulesScene.size.width * 0.5 - 200, y: rulesScene.size.height * 0.6 - 100) + node1.zPosition = 4 + + text2 = SKLabelNode(text: "wtf") + self.text2.position = CGPoint(x: rulesScene.size.width * 0.5 , y: rulesScene.size.height * 0.8 - 500) + + node2 = SKSpriteNode(texture: texture, size: CGSize(width: 30.0, height: 30.0) ) + node2.position = CGPoint(x: rulesScene.size.width * 0.5 - 200, y: rulesScene.size.height * 0.6 - 100) + node2.zPosition = 4 + + text3 = SKLabelNode(text: "30 Sekunden Zeit pro Runde") + text3.position = CGPoint(x: rulesScene.size.width * 0.5 + 25, y: rulesScene.size.height * 0.6 - 110) + + node3 = SKSpriteNode(texture: texture, size: CGSize(width: 30.0, height: 30.0) ) + node3.position = CGPoint(x: rulesScene.size.width * 0.5 - 200, y: rulesScene.size.height * 0.6 - 160) + node3.zPosition = 4 + + text4 = SKLabelNode(text: "20 Runden") + text4.position = CGPoint(x: rulesScene.size.width * 0.5 - 100, y: rulesScene.size.height * 0.6 - 170) + + } + self.header.position = CGPoint(x: rulesScene.size.width * 0.5 - 100 , y: rulesScene.size.height * 0.8) + self.header.fontName = "Courier-Bold" + self.header.fontColor = .black + self.header.fontSize = 30 + self.header.zPosition = 5 + + self.text1.fontName = "Courier-Bold" + self.text1.fontColor = .black + self.text1.fontSize = 25 + self.text1.zPosition = 5 + + self.text2.fontName = "Courier-Bold" + self.text2.fontColor = .black + self.text2.fontSize = 25 + self.text2.zPosition = 5 + + self.text3.fontName = "Courier-Bold" + self.text3.fontColor = .black + self.text3.fontSize = 25 + self.text3.zPosition = 5 + + self.text4.fontName = "Courier-Bold" + self.text4.fontColor = .black + self.text4.fontSize = 25 + self.text4.zPosition = 5 + + super.init() + + /* overlay = SKSpriteNode(color: UIColor.init(red: 0, green: 0, blue: 0, alpha: 0.7), size: menuScene.size) + overlay.anchorPoint = menuScene.anchorPoint + overlay.zPosition = 3 */ + } + + required init?(coder: NSCoder) { + fatalError("init(coder:) has not been implemented") + } +} diff --git a/GoldWars/GoldWars/Scenes/MenuScene.swift b/GoldWars/GoldWars/Scenes/MenuScene.swift index f7f145b..02da229 100644 --- a/GoldWars/GoldWars/Scenes/MenuScene.swift +++ b/GoldWars/GoldWars/Scenes/MenuScene.swift @@ -53,6 +53,15 @@ class MenuScene: SKScene { GameCenterManager.sharedInstance.authUser() } })) + entityManager.add(Button(name: "regelwerkButton", + textureName: "yellow_questionmark", + text: "", + position: CGPoint(x: self.size.width - 50, y: self.size.height - 50), + onButtonPress: { + print("pressed button") + let scene = RulesScene(size: self.size) + self.loadScene(scene: scene) + })) entityManager.add(Background(size: self.size)) entityManager.add(SpinningLogoEntity(position: CGPoint(x: midX, y: midY + 200)))