home *** CD-ROM | disk | FTP | other *** search
/ 600 Games / 600games.iso / Nave / planetx.swf / scripts / frame_17 / DoAction_10.as next >
Encoding:
Text File  |  2006-06-13  |  1.3 KB  |  56 lines

  1. function fuelPadClass()
  2. {
  3. }
  4. fuelPadClass.prototype = new MovieClip();
  5. fuelPadClass.prototype.onLoad = function()
  6. {
  7.    this.x = this._x;
  8.    this.y = this._y;
  9.    this.startx = this.x;
  10.    this.starty = this.y;
  11.    this.c = 0;
  12.    this.d = 15;
  13. };
  14. fuelPadClass.prototype.onEnterFrame = function()
  15. {
  16.    if(_root.state == "paused")
  17.    {
  18.    }
  19.    if(_root.state == "playing")
  20.    {
  21.       this.ty = Math.abs(py - (this.y - 15));
  22.       if(this.ty < 15)
  23.       {
  24.          this.tx = Math.abs(px - this.x);
  25.          if(this.tx < 20)
  26.          {
  27.             px = this.x;
  28.             leftThrust = 0;
  29.             rightThrust = 0;
  30.             playerFuel += 0.25;
  31.             thrusting = 0;
  32.             addThrust = 0;
  33.             if(playerYspeed > 0)
  34.             {
  35.                playerYspeed = 0;
  36.             }
  37.             playerState = "refueling";
  38.             if(playerFuel > 100)
  39.             {
  40.                playerFuel = 100;
  41.             }
  42.             if(playerFuel < 100)
  43.             {
  44.                this.c = this.c + 1;
  45.                if(this.c > this.d)
  46.                {
  47.                   this.c = 0;
  48.                   refuelSnd.start();
  49.                }
  50.             }
  51.          }
  52.       }
  53.    }
  54. };
  55. Object.registerClass("fuelPad",fuelPadClass);
  56.