var text_Dragon;
var text_VS;
var text_Archer;

var Menu = {

    preload : function () {
        //NOTHING HERE PLEASE! ALL DOWNLOADS MUST BE DONE IN BOOT STATE
    },

    create: function () {

        // Add menu screen.
        game.add.sprite(0, 0, 'menu');
        group = game.add.group();

        var button_play = game.make.button(210, 180, 'button_1', actionPlay, this, 2, 1, 0);
        //var button_test = game.make.button(210, 310, 'button_1', actionTest, this, 2, 1, 0);
        var button_regles = game.make.button(210, 440, 'button_1', actionRegles, this, 2, 1, 0);
        //var button_options = game.make.button(210, 570, 'button_1', actionOnClick, this, 2, 1, 0);
        
        var style = { font: "bold 56px Wood_Stevens_Bold", fill: "#500000", boundsAlignH: "center", boundsAlignV: "middle" };
        
        var text_Play = game.add.text(335, 230, translation.get('Jouer'), style);
        text_Play.anchor.set(0.5,0.5);
        /*var text_Test = game.add.text(335, 360, translation.get('Tester'), style);
        text_Test.anchor.set(0.5,0.5);*/
        var text_Regle = game.add.text(335, 490, translation.get('Options'), style);
        text_Regle.anchor.set(0.5,0.5);
        
        text_Dragon = game.add.text(770, 360, 'DRAGON', { font: "128px AlphaWood", fill: "#500000", boundsAlignH: "center", boundsAlignV: "middle" });
        text_VS = game.add.text(900, 500, 'VS', { font: "128px AlphaWood", fill: "#500000", boundsAlignH: "center", boundsAlignV: "middle" });
        text_Archer = game.add.text(740, 640, 'ARCHERS', { font: "128px AlphaWood", fill: "#500000", boundsAlignH: "center", boundsAlignV: "middle" });
        
        var archer = game.make.sprite(450,350, 'archerStandMenu');
        anim = archer.animations.add('stand');

        //window.rich = button_play;

        //button.onInputOver.add(over, this);
        //button.onInputOut.add(out, this);

        //game.input.onDown.addOnce(removeGroup, this);

        group.add(button_play);
        //group.add(button_test);
        group.add(button_regles);
        group.add(text_Play);
        //group.add(text_Test);
        group.add(text_Regle);
        group.add(archer);
        group.add(text_Dragon);
        group.add(text_VS);
        group.add(text_Archer);
        
        anim.play(25, true);
        
        music_menu = game.add.audio('sound_menu',1,true);
        music_menu.play();
    }

};

function actionPlay () {
    sound_clic = game.add.audio('sound_clic_wood');
    sound_clic.play();
    game.state.start('GameMgr');
}

/*function actionTest () {
    game.state.start('GameMgr');
}*/

function actionRegles () {
    text_Dragon.destroy();
    text_VS.destroy();
    text_Archer.destroy();
    var style = { font: "24px Wood_Stevens_Bold", fill: "#500000", boundsAlignH: "center", boundsAlignV: "middle" };
    var tuto = game.add.text(700,390, translation.get(texts.MENU_TXT_REGLES), style);
}

function actionOptions () {
    game.state.start('GameMgr');
}