/**
* Created by Largoyle on 12/04/2014.
*/
var __extends = this.__extends || function (d, b) {
    for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];
    function __() { this.constructor = d; }
    __.prototype = b.prototype;
    d.prototype = new __();
};
/// <reference path="H:/Webpages/LudumDare/LD30/_assets/phaser/build/phaser.d.ts" />
var LEesLD30;
(function (LEesLD30) {
    var MainMenu = (function (_super) {
        __extends(MainMenu, _super);
        function MainMenu() {
            _super.apply(this, arguments);
        }
        MainMenu.prototype.create = function () {
            // load title text
            this.myTitle = this.add.sprite(this.world.centerX, this.world.centerY * 0.75, 'titletext');
            this.myTitle.anchor.setTo(0.5, 0.5);
            this.myTitle.alpha = 0;

            //            this.myTitle.scale.x = 2;
            //            this.myTitle.scale.y = 2;
            // set bkgr color
            this.game.stage.backgroundColor = '#3d3d3d';

            // add logo
            this.myLogo = this.add.sprite(this.world.centerX - 145, 150, 'logo');

            // this.myLogo.anchor.setTo(0, 0.5);
            // fade in titletext
            this.add.tween(this.myTitle).to({ alpha: 1 }, 1000, Phaser.Easing.Linear.None, true);

            // tween the logo
            this.add.tween(this.myLogo).to({ y: 320 }, 1500, Phaser.Easing.Elastic.Out, true);

            // any user interaction makes it start
            this.input.onDown.addOnce(this.fadeOut, this);
        };

        MainMenu.prototype.fadeOut = function () {
            this.add.tween(this.myTitle).to({ alpha: 0 }, 800, Phaser.Easing.Linear.None, true);
            var tween = this.add.tween(this.myLogo).to({ y: 800 }, 1000, Phaser.Easing.Linear.None, true);

            tween.onComplete.add(this.startGame, this);
        };

        MainMenu.prototype.startGame = function () {
            this.game.state.start('Level1', true, false);
        };
        return MainMenu;
    })(Phaser.State);
    LEesLD30.MainMenu = MainMenu;
})(LEesLD30 || (LEesLD30 = {}));
//# sourceMappingURL=MainMenu.js.map
