//
//  MyScene.swift
//  ArkitDoushiQi
//
//  Created by Enzo JOLYS on 27/05/2024.
//

import Foundation
import SpriteKit
import DouShouQiModel

class GameScene : SKScene {
    
    let imageBoard:SKSpriteNode = SKSpriteNode(imageNamed: "board")
    
    
    var pieces: [Owner : [SpriteMoople]] = [ .player1 : [ SpriteMoople(nameImage: "catMeeple", couleur: .red),
                                                          SpriteMoople(nameImage: "dogMeeple", couleur: .red),
                                                          SpriteMoople(nameImage: "leopardMeeple", couleur: .red),
                                                          SpriteMoople(nameImage: "lionMeeple", couleur: .red),
                                                          SpriteMoople(nameImage: "ratMeeple", couleur: .red),
                                                          SpriteMoople(nameImage: "wolfMeeple", couleur: .red)],
                                             .player2 : [ SpriteMoople(nameImage: "catMeeple", couleur: .blue),
                                                          SpriteMoople(nameImage: "dogMeeple", couleur: .blue),
                                                          SpriteMoople(nameImage: "leopardMeeple", couleur: .blue),
                                                          SpriteMoople(nameImage: "lionMeeple", couleur: .blue),
                                                          SpriteMoople(nameImage: "ratMeeple", couleur: .blue),
                                                          SpriteMoople(nameImage: "wolfMeeple", couleur: .blue)]]
    
    override init(size: CGSize) {
        super.init(size: size)
        
        // --  -- //
        scaleMode = .aspectFit
        anchorPoint = CGPoint(x: 0.5, y: 0.5)
        self.addChild(imageBoard)
        // --  -- //
        
        for c in pieces.flatMap({ _,values in return values })
        {
            self.addChild(c)
        }
        
        
    }
    
    
    
    
    required init?(coder aDecoder: NSCoder) {
        super.init(coder: aDecoder)
    }
}

