package { import flash.display.Bitmap; public class TileView extends GameObjectView { public static const WIDTH:Number = 48; public static const HEIGHT:Number = 24; private var firstDraw:Boolean = true; public var layerIndex:int; protected var bitmap:Bitmap; protected var _attachedViews:Vector.; public function TileView(model:TileModel, layerIndex:int = 0) { super(model); this.layerIndex = layerIndex; _attachedViews = new Vector.; } public function get attachedViews():Vector. { return _attachedViews; } override public function draw(delta:Number):void { if (firstDraw) { var bitmapClass:Class; bitmapClass = Embeds.tileForType(TileModel(model).tileType); if (bitmapClass != null) { bitmap = new bitmapClass(); bitmap.x = -bitmap.width / 2; bitmap.y = 0; addChild(bitmap); } firstDraw = false; } } } }