package  
{
	import flash.utils.ByteArray;
	import net.flashpunk.Entity;
	import net.flashpunk.Graphic;
	import net.flashpunk.Mask;
	import net.flashpunk.graphics.Tilemap;
	import net.flashpunk.masks.Grid	
	import flash.utils.ByteArray
	import flash.geom.Point
	
	
	public class Level extends Entity 
	{
		private var tileSize:int = new int(48);
		public var lowerRightPoint:Point = new Point(768, 576);
		private var _tiles:Tilemap;
		private var _grid:Grid;
		public function Level(xml:Class) 
		{
			_tiles = new Tilemap(Assets.SPRITE_TILESET, lowerRightPoint.x, lowerRightPoint.y, tileSize, tileSize);
			graphic = _tiles;
			layer = 1;
			/***********************************************************/
			/*Level Appearance*/
			/***********************************************************/
			//level perimeter
			_tiles.setRect(0, 0, 1, 15, 3);		//left side wall
			_tiles.setRect(15, 0, 1, 15, 3);	//right side wall
			_tiles.setRect(0, 0, 15, 1, 3);		//ceiling barrier
			_tiles.setRect(0, 11, 16, 1, 3);	//floor platform
							
			//Upper Left StairCase
			_tiles.setRect(5, 3, 2, 2, 3);
			_tiles.setTile(4, 4, 3);
			
			//Upper Right StairCase
			_tiles.setRect(9, 3, 2, 2, 3);
			_tiles.setTile(11, 4, 3);
			
			//Lower Left StairCase
			_tiles.setRect(5, 8, 1, 3, 3);	 
			_tiles.setRect(4, 9, 1, 2, 3);
			_tiles.setTile(3, 10, 3);
			
			//Lower Right StairCase
			_tiles.setRect(10, 8, 1, 3, 3);  
			_tiles.setRect(11, 9, 1, 2, 3);
			_tiles.setTile(12, 10, 3);
			
			//misc platforms
			_tiles.setRect(7, 8, 2, 1, 3);	//horizontal Center			
			_tiles.setTile(1, 6, 3);		//horizontal Left middle
			_tiles.setTile(14, 6, 3);		//horizontal Right middle			
			/***********************************************************/			
			/*Level Collisions*/
			/***********************************************************/
			_grid = new Grid(768, 576, 48, 48, 0, 0);			
			mask = _grid;
			
			//level perimeter
			_grid.setRect(0, 0, 1, 15, true);		//left side wall
			_grid.setRect(15, 0, 1, 15, true);	//right side wall
			_grid.setRect(0, 0, 15, 1, true);		//ceiling barrier
			_grid.setRect(0, 11, 16, 1, true);	//floor platform
							
			//Upper Left StairCase
			_grid.setRect(5, 3, 2, 2, true);
			_grid.setTile(4, 4, true);
			
			//Upper Right StairCase
			_grid.setRect(9, 3, 2, 2, true);
			_grid.setTile(11, 4, true);
			
			//Lower Left StairCase
			_grid.setRect(5, 8, 1, 3, true);	 
			_grid.setRect(4, 9, 1, 2, true);
			_grid.setTile(3, 10, true);
			
			//Lower Right StairCase
			_grid.setRect(10, 8, 1, 3, true);  
			_grid.setRect(11, 9, 1, 2, true);
			_grid.setTile(12, 10, true);
			
			//misc platforms
			_grid.setRect(7, 8, 2, 1, true);	//horizontal Center			
			_grid.setTile(1, 6, true);		//horizontal Left middle
			_grid.setTile(14, 6, true);		//horizontal Right middle			
			/***********************************************************/						
			type = "level";
		}	
	}

}