package  
{
	/**
	 * ...
	 * @author beisik
	 */
	public class Level 
	{
		public var left: Level, rigt: Level, top: Level, bottom: Level;
		
		public var apples: Array;
		public var rocks: Array;
		public var saws: Array;
		
		public var game: Game;
		public var x: Number, y: Number;
		
		public var num: uint;
		
		public function Level(game: Game, x: Number, y: Number, number: uint) 
		{
			left = null;
			rigt = null;
			bottom = null;
			top = null;
			
			this.game = game;
			this.x = x;
			this.y = y;
			
			rocks = new Array();
			apples = new Array();
			saws = new Array();
			
			this.num = number;
		}
		
		public function addRock(x: Number, y: Number, image: uint): void
		{
			rocks[rocks.length] = new Rock(x + this.x, y + this.y, image);
			game.rocksSprite.addChild(rocks[rocks.length - 1]);
			game.shadowSprite.addChild(rocks[rocks.length - 1].shadow);
		}
		
		public function addApple(): void
		{
			apples[apples.length] = new Apple(this);
			game.applesSprite.addChild(apples[apples.length - 1]);
			game.shadowSprite.addChild(apples[apples.length - 1].shadow);
		}
		
		public function addSaw(x: Number, y: Number, updown: Boolean, direction: Boolean): void
		{
			saws[saws.length] = new Saw(x + this.x, y + this.y, updown, direction);
			game.sawsSprite.addChild(saws[saws.length - 1]);
			game.shadowSprite.addChild(saws[saws.length - 1].shadow);
		}
		
		public function addTop(l: Level): void
		{
			top = l;
			l.bottom = this;
		}
		
		public function addBottom(l: Level): void
		{
			bottom = l;
			l.top = this;
		}
		
		public function addLeft(l: Level): void
		{
			left = l;
			l.rigt = this;
		}
		
		public function addRight(l: Level): void
		{
			rigt = l;
			l.left = this;
		}
		
	}

}