package com.Tutorial 
{
    import com.adamatomic.flixel.*;
	/**
	 * ...
	 * @author Stephen Lavelle
	 */
	public class IntroState extends FlxState
	{
		private var _introTimer:Number;
		private var _pressed:Boolean;
		private var _gameOver:Boolean;
		private var _text:FlxText;
		
		private var _talk:Array = ["My name is mister math", "I am a super genius mathematician, and I will guide you through the", "world", "of", "mathematics.", "Let me show you some calculations I've been working on..."];
		private var _curline:int = 0;
		
		public function IntroState():void
		{
			_introTimer = 2;
			_pressed = false;
			_text = new FlxText(0, 10, FlxG.width, FlxG.height, "", 0xffc35752, null, 32, "left");
			_curline = -1;
			updatetext();
			this.add(_text);			
		
		}
		
		private function updatetext():Boolean
		{
			_curline++;
			if (_curline < _talk.length)
			{
				_text.setText(_talk[_curline] , true);
				return false;
			}
			else
			{
				return true;
			}
		}
        override public function update():void
		{			
			if (FlxG.justPressed(FlxG.A || FlxG.B))
			{
				if (updatetext())
					FlxG.switchState(WalkState);
			}

			super.update();
		}		
	}
}