class Boot extends Phaser.Scene {
    constructor() {
        super('Boot');
    }

    preload() {
        this.load.spritesheet('btn_play', 'assets/btnPlay.png', {frameWidth: 650, frameHeight: 170});
        this.load.spritesheet('btn_duel', 'assets/btnDuel.png', {frameWidth: 269, frameHeight: 262});
        this.load.spritesheet('btn_last', 'assets/btnLast.png', {frameWidth: 269, frameHeight: 262});
        this.load.spritesheet('btn_team', 'assets/btnTeam.png', {frameWidth: 269, frameHeight: 262});
        this.load.spritesheet('btn_flag', 'assets/btnFlag.png', {frameWidth: 269, frameHeight: 262});
        this.load.spritesheet('btn_map', 'assets/btnMap.png', {frameWidth: 269, frameHeight: 262});
        this.load.image('background', 'assets/background.png');
    }

    create() {
        let style = {font: '200px stencil', fill: "#e2e2e2"};
        this.add.text(WIDTH_WINDOW / 2, HEIGHT_WINDOW / 3, "WARIA", style).setOrigin(0.5, 0.5);
        let btn = this.add.sprite(WIDTH_WINDOW / 2, (HEIGHT_WINDOW / 3) * 2, 'btn_play').setInteractive();
        //btn.setFrame(0);
        btn.on('pointerout', () => btn.setFrame(0));
        btn.on('pointerover', () => btn.setFrame(1));
        btn.on('pointerdown', () => this.clickPlay(btn));
    }

    clickPlay(btn) {
        btn.setFrame(2);
        console.log("Play");
        this.scene.start('Type');
    }
}