package game.GameMain.LevelTiles
{
	import flash.display.Bitmap;
	import flinjin.Flinjin;
	import flinjin.graphics.Sprite;
	import game.GameMain.LevelScroll;
	import game.GameMain.LevelTiles.LevelParts.Leaf;
	import game.GameMain.Mobs.MantisMob;
	import game.GameMain.TileLevel;
	
	/**
	 * ...
	 * @author Michael Miriti <m.s.miriti@gmail.com>
	 */
	public class Tile2 extends LevelTile
	{
		[Embed(source="../../../assets/level-tiles/2_lvl.png")]
		private static var _backBmp:Class;
		
		[Embed(source="../../../assets/level-tiles/2_mask.png")]
		private static var _mask:Class;
		
		private var _leaf:Leaf = new Leaf();
		
		override public function Dispose():void
		{
			(_parentSprite as LevelScroll).addRandomTile();
			super.Dispose();
		}
		
		override public function InitMobs():void
		{
			
			if (_flipHorizontal)
			{
				_leaf.x = width - 385;// - _leaf.width;
				_leaf.y = y + 570 - 16;
				_leaf.flipHorizontal = false;
			}
			else
			{
				_leaf.x = 385 - _leaf.width;
				_leaf.y = y + 570 - 16;
				_leaf.flipHorizontal = true;
			}
			
			(_parentSprite as LevelScroll).addTile(_leaf, true);
			super.InitMobs();
		}
		
		public function Tile2()
		{
			super(480, 640);
			Bmp = new Sprite(new _backBmp() as Bitmap);
			addSprite(Bmp);
			
			Mask = (new _mask() as Bitmap).bitmapData;
		}
	
	}

}