PrincipalGame.Preload = function(){


}

PrincipalGame.Preload.prototype = {

	init : function(){


	},
	preload: function(){




/*
		var text = "Loading...";
		var style = { font: "40px Arial", fill: "#00FF00", aling: "center"};
		this.game.add.text(this.game.width / 2, 100, text, style).anchor.setTo(0.5, 0.5);
*/
        var splash = game.cache.getImage('splash1');
		var preloaderBar = game.cache.getImage('preloaderBar');
        var preloaderFrame = game.cache.getImage('preloaderFrame');
        var loading = game.cache.getImage('loading');

        this.splash = this.add.sprite(0, 0, 'splash1');
        this.loading = this.add.sprite(game.world.width/2 - loading.width/2 + 1, game.world.height/2 - loading.height *2.5 , 'loading');
		this.preloadBar = this.add.sprite(game.world.width/2 - preloaderBar.width/2 + 1, game.world.height/2 - preloaderBar.height/2 , 'preloaderBar');

		this.add.sprite(game.world.width/2 - preloaderFrame.width/2, game.world.height/2 - preloaderFrame.height/2 , 'preloaderFrame');
		this.load.setPreloadSprite(this.preloadBar);

		// +++ Splash +++
		this.load.image('splash','assets/images/splash.png');
		//this.load.audio('cumparsita','assets/audio/cumparsita.ogg');
		this.load.audio('cumparsita','assets/audio/cumparsita.wav');
		// --- Splash ---

		// +++ Game Over +++
		this.load.audio('gameOver','assets/audio/gameOver.ogg');
		// --- Game Over ---

		this.load.audio('falling','assets/sounds/falling.ogg');
		this.load.audio('crash1','assets/sounds/crash1.ogg');
		this.load.audio('crash2','assets/sounds/crash2.ogg');

		this.load.image('explosion', 'assets/images/explosion.png');

		this.load.image('tiled', 'assets/images/tiled.png');
		
		this.load.image('tileset', 'assets/images/tiled.png');
		this.load.tilemap('level1', 'assets/levels/level.json', null, Phaser.Tilemap.TILED_JSON)

		this.load.audio('Do','assets/sounds/Do.ogg');
		this.load.audio('Mi', 'assets/sounds/Mi.ogg');
		this.load.audio('Sol', 'assets/sounds/Sol.ogg');
		this.load.audio('Alarm', 'assets/sounds/Alarm.ogg');

		// El conversor que tengo hace que al pasar de .wav a .ogg el loop no funcione bien
		//this.load.audio('InGame', 'assets/audio/ingame.ogg');
		this.load.audio('InGame', 'assets/audio/ingame.wav');
		
		this.load.spritesheet('icon0','assets/images/icon0.png',16,16,40);

		this.load.image('tower','assets/images/tower.png');
		this.load.image('bgbotonera','assets/images/bgbotonera.png');
		this.load.image('osciloscopioFront','assets/images/osciloscopioFront.png');
		this.load.image('osciloscopiobg','assets/images/osciloscopiobg.png');
		
		this.load.spritesheet('target1','assets/images/target1.png', 430, 299);
		this.load.spritesheet('target2','assets/images/target2.png', 430, 299);
		this.load.spritesheet('target3','assets/images/target3.png', 430, 299);

		this.load.image('bubble', 'assets/images/bubble.png');

        this.load.image('bg', 'assets/images/bg.png');
        this.load.image('gameover', 'assets/images/gameover.png');

		this.load.image('ciudad', 'assets/images/ciudad.png');
		this.load.image('ciudad1', 'assets/images/ciudad1.png');
		this.load.image('ciudad2', 'assets/images/ciudad2.png');
		this.load.image('ciudad3', 'assets/images/ciudad3.png');
        this.load.image('ciudad4', 'assets/images/ciudad4.png');
        this.load.image('ciudad5', 'assets/images/ciudad5.png');
        this.load.image('ciudad6', 'assets/images/ciudad6.png');

        this.load.image('fondo', 'assets/images/fondo1.png');
        this.load.image('fondo1', 'assets/images/fondo2.png');
        this.load.image('fondo2', 'assets/images/fondo3.png');
        this.load.image('fondo3', 'assets/images/fondo4.png');
        this.load.image('fondo4', 'assets/images/fondo5.png');
        this.load.image('fondo5', 'assets/images/fondo6.png');
        this.load.image('fondo6', 'assets/images/fondo7.png');
        this.load.image('start', 'assets/images/start.png');

        this.load.image('presentacion0', 'assets/images/presentation0.png');
        this.load.image('presentacion1', 'assets/images/presentation1.png');
        this.load.image('presentacion2', 'assets/images/presentation2.png');


		//this.load.image('burbujaLow', 'assets/images/burbujaLow.png');
		//this.load.image('burbujaMed', 'assets/images/burbujaMed.png');
		//this.load.image('burbujaHigh', 'assets/images/burbujaHigh.png');
	},
	create: function(){
		this.state.start('MainMenu');
		//this.state.start('GameOver');
	}

}
