topical media & game development

talk show tell print

lib-flex-animation-code-05-Snow.ax

lib-flex-animation-code-05-Snow.ax (swf ) [ flash ] flex


  package
  {
          import flash.display.Sprite;
  
          public class @ax-lib-flex-animation-code-05-Snow extends Sprite
          {
                  public var vx:Number;
                  public var vy:Number;
                  
                  public function @ax-lib-flex-animation-code-05-Snow()
                  {
                          graphics.beginFill(0xffffff, .7);
                          graphics.drawCircle(0, 0, 2);
                          graphics.endFill();
                          
                          vx = 0;
                          vy = 1;
                  }
                  
                  public function update():void
                  {
                          vx += Math.random() * .2 - .1;
                          vx *= .95;
                          x += vx;
                          y += vy;
                  }
          }
  }


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