add addLines, connectBases
This commit is contained in:
parent
105a55644f
commit
dace2364da
@ -104,6 +104,53 @@ class GameScene: SKScene {
|
||||
}
|
||||
}
|
||||
|
||||
func addLine(base1: Base , base2: Base){
|
||||
let line = SKShapeNode()
|
||||
let linePath = CGMutablePath()
|
||||
linePath.move(to: base1.position)
|
||||
linePath.addLine(to: base2.position)
|
||||
line.path = linePath
|
||||
line.strokeColor = SKColor.white
|
||||
addChild(line)
|
||||
|
||||
}
|
||||
|
||||
func connectBases(){
|
||||
player[0].addAvailableBase(base: bases[0])
|
||||
player[0].addAvailableBase(base: bases[1])
|
||||
player[0].addAvailableBase(base: bases[2])
|
||||
|
||||
bases[0].addAvailableBase(base: bases[3])
|
||||
|
||||
bases[1].addAvailableBase(base: bases[3])
|
||||
bases[1].addAvailableBase(base: bases[4])
|
||||
|
||||
bases[2].addAvailableBase(base: bases[4])
|
||||
|
||||
bases[3].addAvailableBase(base: bases[5])
|
||||
bases[3].addAvailableBase(base: bases[6])
|
||||
|
||||
bases[4].addAvailableBase(base: bases[7])
|
||||
bases[4].addAvailableBase(base: bases[6])
|
||||
|
||||
player[1].addAvailableBase(base: bases[5])
|
||||
player[1].addAvailableBase(base: bases[6])
|
||||
player[1].addAvailableBase(base: bases[7])
|
||||
|
||||
for base in player{
|
||||
for availableBase in base.availableBases{
|
||||
addLine(base1: base, base2: availableBase)
|
||||
}
|
||||
}
|
||||
|
||||
for base in bases{
|
||||
for availableBase in base.availableBases{
|
||||
addLine(base1: base, base2: availableBase)
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
func touchDown(atPoint pos : CGPoint) {
|
||||
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user