|
|
|
@ -50,9 +50,26 @@ class GameScene : SKScene {
|
|
|
|
|
self.addChild(piece)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
initializeBoard(game.board)
|
|
|
|
|
displayBoard(game.board)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func initializeBoard(_ board: Board) {
|
|
|
|
|
let player1Animals: [Animal] = [.rat, .cat, .dog, .wolf, .leopard, .lion, .tiger, .elephant]
|
|
|
|
|
let player2Animals: [Animal] = [.rat, .cat, .dog, .wolf, .leopard, .lion, .tiger, .elephant]
|
|
|
|
|
|
|
|
|
|
for (index, animal) in player1Animals.enumerated() {
|
|
|
|
|
pieces[.player1]?[animal]?.cellPosition = CGPoint(x: index, y: 0)
|
|
|
|
|
pieces[.player1]?[animal]?.cellPosition = CGPoint(x: index, y: 1)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
for (index, animal) in player2Animals.enumerated() {
|
|
|
|
|
pieces[.player2]?[animal]?.cellPosition = CGPoint(x: index, y: board.nbRows - 1)
|
|
|
|
|
pieces[.player2]?[animal]?.cellPosition = CGPoint(x: index, y: board.nbRows - 2)
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
func displayBoard(_ board: Board) {
|
|
|
|
|
for row in 0..<board.nbRows {
|
|
|
|
|
for col in 0..<board.nbColumns {
|
|
|
|
|