package com.Tutorial 
{
    import com.adamatomic.flixel.*;
	import com.adamatomic.flixel.data.FlxLogoPixel;
	
	/**
	 * ...
	 * @author Stephen Lavelle
	 */
	public class BattleOver extends FlxState
	{ 
		public static var lyrMain:FlxLayer;
		
		public function BattleOver() 
		{
			lyrMain = new FlxLayer();
									
			if (BattleState.s1 < BattleState.s2)
			{
				lyrMain.add(new FlxText(0, FlxG.height / 2 - 8, FlxG.width, 16, "YOU WON", 0xff8d431f, null, 16, "center"));
				FlxG.hasdie[BattleState.targetDie] = true;
				BattleState.dieCount++;				
			}
			else if (BattleState.s1>BattleState.s2)
				lyrMain.add(new FlxText(0, FlxG.height/2-8,FlxG.width, 16, "YOU LOST", 0xff8d431f,null,16,"center"));
			else
				lyrMain.add(new FlxText(0, FlxG.height/2-8,FlxG.width, 16, "DRAW GAME", 0xff8d431f,null,16,"center"));
			
			lyrMain.add( new FlxText(16, 129, 200, 8, "press x to continue", 0xff8d431f,null,8));

			this.add(lyrMain);
		}
		
		override public function update():void
		{
			if (FlxG.justPressed(FlxG.A) || FlxG.justPressed(FlxG.B))
			{				
				ChooseDieState.showInteract = true;
				
				if (BattleState.dieCount == 32)
				{
					FlxG.switchState(GameOver);
					FlxG.setMusic(MenuState.SndMusic);
				}
				else
				{
					FlxG.switchState(WalkState);

					FlxG.setMusic(MenuState.SndAmbient);
				}
			}
		}
	}

}