add unitCount and unitType for basePlayer1 and basePlayer2

This commit is contained in:
72haja 2020-04-22 18:17:07 +02:00
parent d8adce88d2
commit 31143265f6

View File

@ -34,8 +34,8 @@ class GameScene: SKScene, SKPhysicsContactDelegate {
let maxX = self.size.width
let midY = self.size.height / 2
let basePlayer1 = Base(color: SKColor.red, position: CGPoint(x: maxX * 0.1, y: midY), name: "Player1" )
let basePlayer2 = Base(color: SKColor.blue, position: CGPoint(x: maxX * 0.9, y: midY), name: "Player2" )
let basePlayer1 = Base(color: SKColor.red, position: CGPoint(x: maxX * 0.1, y: midY), name: "Player1", unitCount: 100, unitType: Unit.General)
let basePlayer2 = Base(color: SKColor.blue, position: CGPoint(x: maxX * 0.9, y: midY), name: "Player2", unitCount: 100, unitType: Unit.General)
basePlayer2.physicsBody = SKPhysicsBody(circleOfRadius: 50)
basePlayer2.physicsBody?.categoryBitMask = physicsBodyNumber.basePlayer2Number
basePlayer2.physicsBody?.collisionBitMask = physicsBodyNumber.emptyNumber