From d5964420157500b438e137ddc769d09a5182ab81 Mon Sep 17 00:00:00 2001 From: 127-Z3R0 <81heti1bif@hft-stuttgart.de> Date: Wed, 22 Apr 2020 14:04:40 +0200 Subject: [PATCH] add physicsbody to base 6-7 and removal to func addPhysicsBodyToBase() --- GoldWars/GoldWars/Game/GameScene.swift | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) diff --git a/GoldWars/GoldWars/Game/GameScene.swift b/GoldWars/GoldWars/Game/GameScene.swift index 30e1450..c6f9651 100644 --- a/GoldWars/GoldWars/Game/GameScene.swift +++ b/GoldWars/GoldWars/Game/GameScene.swift @@ -51,12 +51,25 @@ class GameScene: SKScene, SKPhysicsContactDelegate { player.append(basePlayer2) createVirginBases() connectBases() - - bases[5].physicsBody = SKPhysicsBody(circleOfRadius: 50) + addPhysicsBodyToBase() + + } + + func addPhysicsBodyToBase() { + bases[5].physicsBody = SKPhysicsBody(circleOfRadius: 20) bases[5].physicsBody?.categoryBitMask = physicsBodyNumber.base5Number bases[5].physicsBody?.collisionBitMask = physicsBodyNumber.emptyNumber bases[5].physicsBody?.contactTestBitMask = physicsBodyNumber.basePlayer2Number - + + bases[6].physicsBody = SKPhysicsBody(circleOfRadius: 20) + bases[6].physicsBody?.categoryBitMask = physicsBodyNumber.base6Number + bases[6].physicsBody?.collisionBitMask = physicsBodyNumber.emptyNumber + bases[6].physicsBody?.contactTestBitMask = physicsBodyNumber.basePlayer2Number + + bases[7].physicsBody = SKPhysicsBody(circleOfRadius: 20) + bases[7].physicsBody?.categoryBitMask = physicsBodyNumber.base7Number + bases[7].physicsBody?.collisionBitMask = physicsBodyNumber.emptyNumber + bases[7].physicsBody?.contactTestBitMask = physicsBodyNumber.basePlayer2Number } func createVirginBases() {