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

    preload() {
    }

    create() {
        let style = {font: '200px stencil', fill: "#e2e2e2"};
        this.add.text(WIDTH_WINDOW / 2, HEIGHT_WINDOW / 4, "WARIA", style).setOrigin(0.5, 1);

        let btnDuel = this.add.sprite((WIDTH_WINDOW / 8) * 3, (HEIGHT_WINDOW / 4) * 2, 'btn_duel').setInteractive();
        this.createbutton(btnDuel);

        let btnLast = this.add.sprite((WIDTH_WINDOW / 8) * 5, (HEIGHT_WINDOW / 4) * 2, 'btn_last').setInteractive();
        this.createbutton(btnLast);

        let btnTeam = this.add.sprite((WIDTH_WINDOW / 8) * 2, (HEIGHT_WINDOW / 4) * 3, 'btn_team').setInteractive();
        this.createbutton(btnTeam);

        let btnFlag = this.add.sprite((WIDTH_WINDOW / 8) * 4, (HEIGHT_WINDOW / 4) * 3, 'btn_flag').setInteractive();
        this.createbutton(btnFlag);

        let btnMap = this.add.sprite((WIDTH_WINDOW / 8) * 6, (HEIGHT_WINDOW / 4) * 3, 'btn_map').setInteractive();
        this.createbutton(btnMap);
    }

    createbutton(btn) {
        btn.displayHeight = HEIGHT_WINDOW / 4;
        btn.scaleX = btn.scaleY;
        btn.on('pointerout', () => btn.setFrame(0));
        btn.on('pointerover', () => btn.setFrame(1));
        btn.on('pointerdown', () => this.clickPlay(btn));
    }

    clickPlay(btn) {
        this.scene.start('Game');
    }
}