package gameStates 
{
	import org.flixel.*;
	/**
	 * ...
	 * @author 
	 */
	public class CreditsState extends FlxState
	{
		
		private var title:FlxText;
		private var Subtitle:FlxText;
		[Embed(source = "../../assets/images/menuBg.png")]public var bgPNG:Class;
		[Embed(source="../../assets/audio/robotito-base 2-Strings4 Pizz.mp3")]public var snd3:Class;
		override public function create():void
		{
			FlxG.bgColor = 0xff999999;	
			
			var spriteFondo:FlxSprite = new FlxSprite(0,0,bgPNG);
			add(spriteFondo); 
			
			title = new FlxText(0,FlxG.height/4,FlxG.width,"Creditos");
			title.size = 40;
			title.alignment = "center";
			title.scrollFactor.x = 0;
			title.scrollFactor.y = 0;
			title.color = 0xFFFFFF;
			title.antialiasing = true;
			title.flicker(3);
			add(title);
			
			Subtitle = new FlxText(0,FlxG.height/2 + 70 ,FlxG.width,"Agustín Fernández Cervellón");
			Subtitle.size = 15;
			Subtitle.alignment = "center";
			Subtitle.scrollFactor.x = 0;
			Subtitle.scrollFactor.y = 0;
			Subtitle.color = 0xffffffff;
			add(Subtitle);
			Subtitle = new FlxText(0,FlxG.height/2 + 100 ,FlxG.width,"Santiago Figueroa");
			Subtitle.size = 15;
			Subtitle.alignment = "center";
			Subtitle.scrollFactor.x = 0;
			Subtitle.scrollFactor.y = 0;
			Subtitle.color = 0xffffffff;
			add(Subtitle);
			Subtitle = new FlxText(0,FlxG.height/2 + 130 ,FlxG.width,"Damián Flores");
			Subtitle.size = 15;
			Subtitle.alignment = "center";
			Subtitle.scrollFactor.x = 0;
			Subtitle.scrollFactor.y = 0;
			Subtitle.color = 0xffffffff;
			add(Subtitle);
			Subtitle = new FlxText(0,FlxG.height/2 + 160 ,FlxG.width,"Javier Klarman");
			Subtitle.size = 15;
			Subtitle.alignment = "center";
			Subtitle.scrollFactor.x = 0;
			Subtitle.scrollFactor.y = 0;
			Subtitle.color = 0xffffffff;
			add(Subtitle);
			Subtitle = new FlxText(0,FlxG.height/2 + 200,FlxG.width,"Musica: Bruno Molteni - SFX: Renzo Fontán");
			Subtitle.size = 15;
			Subtitle.alignment = "center";
			Subtitle.scrollFactor.x = 0;
			Subtitle.scrollFactor.y = 0;
			Subtitle.color = 0xffffffff;
			add(Subtitle);
			
			FlxG.playMusic(snd3, 1);
			
		}

		override public function update():void
		{
			super.update();
			
			if (FlxG.keys.justPressed("SPACE"))
			{
				onButton();
			}
		}
		
		private function onButton():void
		{
			FlxG.flash(0xffc2c2c2, 0.5);
			FlxG.fade(0xff000000, 0.5, onFade);
		}
		
		private function onFade():void
		{
			Registry.init();
			FlxG.switchState(new StoryState);
		}
			
		
	}

}