delete portrait-mode and more refactoring with master Aldin

This commit is contained in:
127-Z3R0 2020-04-22 16:29:28 +02:00
parent 6712398f6a
commit b87eb3dd53
3 changed files with 8 additions and 10 deletions

View File

@ -15,7 +15,7 @@ class GameScene: SKScene, SKPhysicsContactDelegate {
var graphs = [String : GKGraph]() var graphs = [String : GKGraph]()
var bases = [Base]() var bases = [Base]()
var player = [Base]() var player = [Base]()
var menu = SKSpriteNode() var popUpOnBaseCollision = SKSpriteNode()
struct physicsBodyNumber { struct physicsBodyNumber {
static let basePlayer1Number: UInt32 = 0b1 static let basePlayer1Number: UInt32 = 0b1
@ -41,9 +41,9 @@ class GameScene: SKScene, SKPhysicsContactDelegate {
basePlayer2.physicsBody?.collisionBitMask = physicsBodyNumber.emptyNumber basePlayer2.physicsBody?.collisionBitMask = physicsBodyNumber.emptyNumber
basePlayer2.physicsBody?.contactTestBitMask = physicsBodyNumber.base5Number & physicsBodyNumber.base6Number & physicsBodyNumber.base7Number basePlayer2.physicsBody?.contactTestBitMask = physicsBodyNumber.base5Number & physicsBodyNumber.base6Number & physicsBodyNumber.base7Number
menu = SKSpriteNode(color: SKColor.blue , size: CGSize(width: self.size.width * 0.4, height: self.size.height * 0.4)) popUpOnBaseCollision = SKSpriteNode(color: SKColor.blue , size: CGSize(width: self.size.width * 0.4, height: self.size.height * 0.4))
menu.position = CGPoint(x: self.size.width * 0.5, y: self.size.height * 0.5) popUpOnBaseCollision.position = CGPoint(x: self.size.width * 0.5, y: self.size.height * 0.5)
menu.zPosition = 2 popUpOnBaseCollision.zPosition = 2
self.addChild(basePlayer1) self.addChild(basePlayer1)
self.addChild(basePlayer2) self.addChild(basePlayer2)
@ -175,8 +175,8 @@ class GameScene: SKScene, SKPhysicsContactDelegate {
override func touchesBegan(_ touches: Set<UITouch>, with event: UIEvent?) { override func touchesBegan(_ touches: Set<UITouch>, with event: UIEvent?) {
for touch in touches { for touch in touches {
let locationUser = touch.location(in: self) let locationUser = touch.location(in: self)
if atPoint(locationUser) == menu { if atPoint(locationUser) == popUpOnBaseCollision {
menu.removeFromParent() popUpOnBaseCollision.removeFromParent()
} }
} }
} }
@ -198,6 +198,6 @@ class GameScene: SKScene, SKPhysicsContactDelegate {
} }
func didBegin(_ contact: SKPhysicsContact) { func didBegin(_ contact: SKPhysicsContact) {
self.addChild(menu) self.addChild(popUpOnBaseCollision)
} }
} }

View File

@ -17,7 +17,7 @@ class GameViewController: UIViewController {
if let view = self.view as! SKView? { if let view = self.view as! SKView? {
if let scene = SKScene(fileNamed: "MenuScene") { if let scene = SKScene(fileNamed: "MenuScene") {
scene.scaleMode = .aspectFill //scene.scaleMode = .aspectFill
view.presentScene(scene) view.presentScene(scene)
//TODO: create dev profile or remove on delivery //TODO: create dev profile or remove on delivery
view.showsFPS = true view.showsFPS = true

View File

@ -38,8 +38,6 @@
</array> </array>
<key>UISupportedInterfaceOrientations~ipad</key> <key>UISupportedInterfaceOrientations~ipad</key>
<array> <array>
<string>UIInterfaceOrientationPortrait</string>
<string>UIInterfaceOrientationPortraitUpsideDown</string>
<string>UIInterfaceOrientationLandscapeLeft</string> <string>UIInterfaceOrientationLandscapeLeft</string>
<string>UIInterfaceOrientationLandscapeRight</string> <string>UIInterfaceOrientationLandscapeRight</string>
</array> </array>