missEmm

Fruit Class

May 11th, 2011
84
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. package code
  2. {
  3.  
  4.     import flash.display.MovieClip;
  5.     import flash.events.Event;
  6.     import flash.events.TimerEvent;
  7.     import flash.utils.Timer;
  8.  
  9.  
  10.     public class FruitClass extends MovieClip
  11.     {
  12.         public var fallingSpeed:Number;
  13.         public static var aNumber:Number;
  14.         public const terminalVelocity:Number = 40;
  15.         public var velocity:Number;
  16.         public static var fruitCount:Number = 0;
  17.         public function FruitClass()
  18.         {
  19.             fruitCount++;
  20.             var mySpeed=1;
  21.             fallingSpeed = mySpeed / 2;
  22.             if (fallingSpeed >=terminalVelocity )
  23.             {
  24.                 fallingSpeed = terminalVelocity;
  25.             }
  26.            
  27.             velocity = mySpeed;
  28.            
  29.             trace(fallingSpeed);
  30.             if(fruitCount<=60)
  31.             {  
  32.                 gotoAndStop("apple");
  33.             }
  34.             else if(fruitCount <=100)
  35.             {
  36.                 gotoAndStop("cherry");
  37.                
  38.             }
  39.             else if (fruitCount <= 140)
  40.             {
  41.                 gotoAndStop("orange");
  42.             }
  43.         }
  44.        
  45.         public function removeFruit():void
  46.         {
  47.             removeChild(this);
  48.         }
  49.  
  50.         public function moveFruit():void
  51.         {
  52.             /*if (velocity > terminalVelocity)
  53.             {
  54.                 velocity = terminalVelocity;
  55.             }*/
  56.             y += velocity;
  57.             rotation += velocity/5;
  58.         }
  59.  
  60.     }
  61.  
  62. }
Advertisement
Add Comment
Please, Sign In to add comment