package  {
	import flash.display.*;
	import flash.geom.*;
  import flash.events.*;
  import flash.net.*;
	import com.terry.engine.*;
	
	public class def {
		public static var TITLEMODE:int = 0;
		public static var CLICKTOSTART:int = 1;
		public static var FOCUSMODE:int = 2;
		public static var PACKINGMODE:int = 3;
		public static var WALKABOUTMODE:int = 4;
		public static var TRASHMODE:int = 5;
		public static var GAMEOVER:int = 6;
		
		public static var TILE_EDITOR:int = 0;
		public static var ENTITY_EDITOR:int = 1;
		public static var SCRIPTBOX_EDITOR:int = 2;
		public static var DOOR_EDITOR:int = 3;
		
		public static var NUMTILES:int = 20;
		
		public static var BLOCK:Number = 0;
		public static var TRIGGER:Number = 1;
		public static var DAMAGE:Number = 2;
		public static var DOOR:Number = 3;
		
		public static var TILESIZE:int = 16;
		public static var SPRITESIZE:int = 32;
		public static var SCREENWIDTH:int = 768/2;
		public static var SCREENHEIGHT:int = 480/2;
		public static var SCREENSCALE:int = 2;
		
		public static var FADED_IN:int = 0;
		public static var FADED_OUT:int = 1;
		public static var FADE_OUT:int = 2;
		public static var FADING_OUT:int = 3;
		public static var FADE_IN:int = 4;
		public static var FADING_IN:int = 5;
		
		public static var FADEACTION_NOTHING:int = 0;
		public static var FADEACTION_CHANGEROOM:int = 1;
		public static var FADEACTION_PACKINGMODE:int = 2;
		public static var FADEACTION_AFTERPACKING:int = 3;
		public static var FADEACTION_TRASHMODE:int = 4;
		public static var FADEACTION_AFTERTRASH:int = 5;
		public static var FADEACTION_INTRO:int = 6;
		public static var FADEACTION_GAMEOVER:int = 7;
		public static var FADEACTION_TITLE:int = 8;
		
		public static var NODIRECTION:int = -1;
		public static var UP:int = 0;
		public static var DOWN:int = 1;
		public static var LEFT:int = 2;
		public static var RIGHT:int = 3;
		
		public static function randomdirection():int { 
			return int(Math.random() * 4); 
		}
		
		public static function oppositedirection(t:int):int {
			if (t == UP) return DOWN;
			if (t == DOWN) return UP;
			if (t == LEFT) return RIGHT;
			if (t == RIGHT) return LEFT;
			return UP;
		}
		
		public static function anticlockwise(t:int, times:int = 1):int {
			if (times > 1) t = anticlockwise(t, times - 1);
			if (t == UP) return LEFT;
			if (t == LEFT) return DOWN;
			if (t == DOWN) return RIGHT;
			if (t == RIGHT) return UP;
			return UP;
		}
		
		public static function clockwise(t:int, times:int = 1):int {
			if (times > 1) t = clockwise(t, times - 1);
			if (t == UP) return RIGHT;
			if (t == RIGHT) return DOWN;
			if (t == DOWN) return LEFT;
			if (t == LEFT) return UP;
			return UP;
		}
	}
}
