diff --git a/DouShouQi_App/DouShouQi_App/Components/Scene/GameScene.swift b/DouShouQi_App/DouShouQi_App/Components/Scene/GameScene.swift index 91954e4..e095e13 100644 --- a/DouShouQi_App/DouShouQi_App/Components/Scene/GameScene.swift +++ b/DouShouQi_App/DouShouQi_App/Components/Scene/GameScene.swift @@ -55,6 +55,39 @@ class GameScene : SKScene { } func initializeBoard(_ board: Board) { + + /*for (lineIndex, currentLine) in game.board.grid.enumerated() { + for (cellIndex, currentCell) in currentLine.enumerated() { + if (currentCell.piece != nil){ + pieces[currentCell.piece!.owner]?[currentCell.piece!.animal]?.cellPosition = CGPoint(x: cellIndex, y: lineIndex) + } + } + }*/ + + for (lineIndex, currentLine) in game.board.grid.enumerated() { + for (cellIndex, currentCell) in currentLine.enumerated() { + if let piece = currentCell.piece { + pieces[piece.owner]?[piece.animal]?.cellPosition = CGPoint(x: cellIndex-3, y: lineIndex-4) + pieces[piece.owner]?[piece.animal]?.cellPosition = CGPoint(x: 0, y: 0) + print("line :", lineIndex, " cologne: ", cellIndex) + } + } + } + + + /*var new_array = game.board.grid.flatMap(pieces => { + pieces.forEach( => { + if (joueur1.pieces.includes(piece)) { + console.log(`La pièce ${piece} appartient à joueur1`); + } else if (joueur2.pieces.includes(piece)) { + console.log(`La pièce ${piece} appartient à joueur2`); + } + }); + // Retourner les pièces pour le new_array (si nécessaire) + return pieces; + });*/ + +/* let player1AnimalsLigne1: [Animal] = [.elephant, .wolf, .tiger, .rat] let player1AnimalsLigne2: [Animal] = [.cat, .dog] let player1AnimalsLigne3: [Animal] = [.leopard, .lion] @@ -91,7 +124,7 @@ class GameScene : SKScene { for (index, animal) in player2AnimalsLigne3.enumerated() { pieces[.player2]?[animal]?.cellPosition = CGPoint(x: index-3, y: 3) pieces[.player2]?[animal]?.cellPosition = CGPoint(x: index, y: 1) - } + }*/ } required init?(coder aDecoder: NSCoder) {