topical media & game development

talk show tell print

lib-flex-animation-code-03-MapTest.ax

lib-flex-animation-code-03-MapTest.ax (swf ) [ flash ] flex


  package
  {
          import com.friendsofed.isometric.DrawnIsoBox;
          import com.friendsofed.isometric.GraphicTile;
          import com.friendsofed.isometric.IsoWorld;
          import com.friendsofed.isometric.MapLoader;
          
          import flash.display.Sprite;
          import flash.display.StageAlign;
          import flash.display.StageScaleMode;
          import flash.events.Event;
          
          [SWF(backgroundColor=0xffffff)]
          public class @ax-lib-flex-animation-code-03-MapTest extends Sprite
          {
                  private var _world:IsoWorld;
                  private var _floor:IsoWorld;
                  private var mapLoader:MapLoader;
                  
                  [Embed(source="tile_01.png")]
                  private var Tile01:Class;
                  
                  [Embed(source="tile_02.png")]
                  private var Tile02:Class;
                  
                  public function @ax-lib-flex-animation-code-03-MapTest()
                  {
                          stage.align = StageAlign.TOP_LEFT;
                          stage.scaleMode = StageScaleMode.NO_SCALE;
                          
                          mapLoader = new MapLoader();
                          mapLoader.addEventListener(Event.COMPLETE, onMapComplete);
                          mapLoader.loadMap("map.txt");
                  }
                  
                  private function onMapComplete(event:Event):void
                  {
                          _world = mapLoader.makeWorld(20);
                          _world.x = stage.stageWidth / 2;
                          _world.y = 100;
                          addChild(_world);
                  }
          }
  }


(C) Æliens 18/6/2009

You may not copy or print any of this material without explicit permission of the author or the publisher. In case of other copyright issues, contact the author.