class Type extends ManageLang {
    constructor(father) {
        super('Type', father);
    }

    preload() {
    }

    create() {
        super.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, 'duel').setInteractive();
        this.createbutton(btnDuel, 'level1');

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

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

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

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

    createbutton(btn, level) {
        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(level));
    }

    clickPlay(level) {
        newGame(this.father, level);
        this.scene.start('Game');
    }
}