package game.GameMain.LevelTiles
{
	import flash.display.Bitmap;
	import flash.display.BitmapData;
	import flash.geom.Point;
	import flinjin.algorithms.collisions.BruteForce;
	import flinjin.events.FlinjinCollisionEvent;
	import flinjin.events.FlinjinEvent;
	import flinjin.events.FlinjinSpriteEvent;
	import flinjin.graphics.Sprite;
	import flinjin.types.BoundingRect;
	import game.GameMain.LevelScroll;
	import game.GameMain.LevelTiles.LevelParts.Leaf;
	
	/**
	 * ...
	 * @author Michael Miriti
	 */
	public class Tile1 extends LevelTile
	{
		[Embed(source="../../../assets/level-tiles/1_lvl.png")]
		private static var _backBmp:Class;
		
		[Embed(source="../../../assets/level-tiles/1_mask.png")]
		private static var _mask:Class;
		
		private var _leaf1:Leaf = new Leaf();
		private var _leaf2:Leaf = new Leaf();
		
		override public function Dispose():void
		{
			(_parentSprite as LevelScroll).addRandomTile();
			super.Dispose();
		}
		
		public function Tile1()
		{
			super(480, 640);
			
			Bmp = new Sprite(new _backBmp() as Bitmap);
			addSprite(Bmp);
			
			Mask = (new _mask() as Bitmap).bitmapData;
		}
		
		override public function InitMobs():void
		{
			if (_flipHorizontal)
			{
				_leaf1.flipHorizontal = true;
				_leaf2.flipHorizontal = true;
				_leaf1.x = width - 127 - _leaf1.width;
				_leaf2.x = width - 222 - _leaf2.width;
			}
			else
			{
				_leaf1.x = 127;
				_leaf2.x = 222;
			}
			
			_leaf1.y = y + 573 - 16;
			_leaf2.y = y + 382 - 16;
			(_parentSprite as LevelScroll).addTile(_leaf1, true);
			(_parentSprite as LevelScroll).addTile(_leaf2, true);
			super.InitMobs();
		}
	}

}