package com.sarmatianHeroes.objects 
{
	import flash.display.*;
	import flash.events.*;
	
	import com.antkarlov.math.*;
	
	public class Heart extends MovieClip
	{
		private var _targetHero:Object;
		private var _vis:MovieClip;
		private var _startY;
	
		public function Heart(target:Object)
		{
			_targetHero = target;
			
			_vis = new lacursore();
			_vis.gotoAndStop("heal");
			_vis.scaleX = _vis.scaleY = 1;
			_vis.x = _targetHero.x + Amath.random(-5,5);
			_vis.y = _targetHero.y;
			_startY = _vis.y;
			addChild(_vis);
			addEventListener( Event.ENTER_FRAME, fly );
		}
	
		
		private function fly( e:Event ):void
		{
			_vis.y--;
			_vis.alpha -= 0.02;
			if(_vis.alpha <0)
			{
				parent.removeChild(this);
				removeEventListener( Event.ENTER_FRAME, fly );
			}
		}
	}
}
