Introduce column based layout
This commit is contained in:
parent
ffd4e0dfe0
commit
918979d750
@ -30,33 +30,36 @@ class TwoPlayerDefaultTestMap: MapProtocoll {
|
|||||||
position: CGPoint(x: self.size.width * 0.1, y: self.size.height / 2),
|
position: CGPoint(x: self.size.width * 0.1, y: self.size.height / 2),
|
||||||
team: .team1
|
team: .team1
|
||||||
)
|
)
|
||||||
entityManager.add(basePlayerOne)
|
|
||||||
|
|
||||||
var genericBasePositions = Array<CGPoint>()
|
let column1 = [
|
||||||
|
Base(position: CGPoint(x: self.size.width * 0.25, y: self.size.height * 0.25)),
|
||||||
|
Base(position: CGPoint(x: self.size.width * 0.25, y: self.size.height * 0.5)),
|
||||||
|
Base(position: CGPoint(x: self.size.width * 0.25, y: self.size.height * 0.75))
|
||||||
|
]
|
||||||
|
|
||||||
// First column
|
let column2 = [
|
||||||
genericBasePositions.append(CGPoint(x: self.size.width * 0.25, y: self.size.height * 0.25))
|
Base(position: CGPoint(x: self.size.width * 0.5, y: self.size.height * 0.333)),
|
||||||
genericBasePositions.append(CGPoint(x: self.size.width * 0.25, y: self.size.height * 0.5))
|
Base(position: CGPoint(x: self.size.width * 0.5, y: self.size.height * 0.666))
|
||||||
genericBasePositions.append(CGPoint(x: self.size.width * 0.25, y: self.size.height * 0.75))
|
]
|
||||||
|
|
||||||
// Second column
|
let column3 = [
|
||||||
genericBasePositions.append(CGPoint(x: self.size.width * 0.5, y: self.size.height * 0.333))
|
Base(position: CGPoint(x: self.size.width * 0.75, y: self.size.height * 0.25)),
|
||||||
genericBasePositions.append(CGPoint(x: self.size.width * 0.5, y: self.size.height * 0.666))
|
Base(position: CGPoint(x: self.size.width * 0.75, y: self.size.height * 0.5)),
|
||||||
|
Base(position: CGPoint(x: self.size.width * 0.75, y: self.size.height * 0.75))
|
||||||
// Third column
|
]
|
||||||
genericBasePositions.append(CGPoint(x: self.size.width * 0.75, y: self.size.height * 0.25))
|
|
||||||
genericBasePositions.append(CGPoint(x: self.size.width * 0.75, y: self.size.height * 0.5))
|
|
||||||
genericBasePositions.append(CGPoint(x: self.size.width * 0.75, y: self.size.height * 0.75))
|
|
||||||
|
|
||||||
for pos in genericBasePositions {
|
|
||||||
entityManager.add(Base(position: pos))
|
|
||||||
}
|
|
||||||
|
|
||||||
// Player two (rightest base)
|
// Player two (rightest base)
|
||||||
let basePlayerTwo = Base(
|
let basePlayerTwo = Base(
|
||||||
position: CGPoint(x: self.size.width * 0.9, y: self.size.height / 2),
|
position: CGPoint(x: self.size.width * 0.9, y: self.size.height / 2),
|
||||||
team: .team2
|
team: .team2
|
||||||
)
|
)
|
||||||
|
|
||||||
|
entityManager.add(basePlayerOne)
|
||||||
|
|
||||||
|
column1.forEach({base in entityManager.add(base)})
|
||||||
|
column2.forEach({base in entityManager.add(base)})
|
||||||
|
column3.forEach({base in entityManager.add(base)})
|
||||||
|
|
||||||
entityManager.add(basePlayerTwo)
|
entityManager.add(basePlayerTwo)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user