topical media & game development

talk show tell print

lib-flex-animation-code-02-Steering2.ax

lib-flex-animation-code-02-Steering2.ax (swf ) [ flash ] flex


  package
  {
          import com.foed.Vector2D;
          import com.foed.SteeredVehicle;
          
          import flash.display.Sprite;
          import flash.display.StageAlign;
          import flash.display.StageScaleMode;
          import flash.events.Event;
  
          public class @ax-lib-flex-animation-code-02-Steering2 extends Sprite
          {
                  private var _small:SteeredVehicle;
                  private var _medium:SteeredVehicle;
                  private var _large:SteeredVehicle;
                  
                  
                  public function @ax-lib-flex-animation-code-02-Steering2()
                  {
                          stage.align = StageAlign.TOP_LEFT;
                          stage.scaleMode = StageScaleMode.NO_SCALE;
                          
                          _small = new SteeredVehicle();
                          _small.scaleX = _small.scaleY = .5;
  //                        _small.mass = .5;
                          _small.position = new Vector2D(300, 400);
                          addChild(_small);
                          
                          _medium = new SteeredVehicle();
                          _medium.position = new Vector2D(100, 100);
                          addChild(_medium);
                          
  //                        _large = new SteeredVehicle();
  //                        _large.scaleX = _large.scaleY = 1.5;
  //                        _large.mass = 2;
  //                        _large.position = new Vector2D(600, 140);
  //                        addChild(_large);
                          
                          addEventListener(Event.ENTER_FRAME, onEnterFrame);
                  }
                  
                  private function onEnterFrame(event:Event):void
                  {
                          _small.wander();
                          _medium.seek(_small.position);
                          _small.update();
                          _medium.update();
  //                        _large.update();
                  }
                  
          }
  }


(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.