home *** CD-ROM | disk | FTP | other *** search
/ Champak 48 / cdrom_image.iso / Games / antipacman.swf / scripts / DefineSprite_213 / frame_2 / DoAction.as
Encoding:
Text File  |  2007-10-01  |  1.6 KB  |  75 lines

  1. i = 1;
  2. while(i <= TotalBalls)
  3. {
  4.    this["P" + i].PrevX = this["P" + i].x;
  5.    this["P" + i].PrevY = this["P" + i].y;
  6.    this["P" + i].x += this["P" + i].Speed * Math.cos(this["P" + i].Dir);
  7.    this["P" + i].y -= this["P" + i].Speed * Math.sin(this["P" + i].Dir);
  8.    if(this["P" + i].Dir > dblPI)
  9.    {
  10.       this["P" + i].Dir -= dblPI;
  11.    }
  12.    if(this["P" + i].Dir < 0)
  13.    {
  14.       this["P" + i].Dir += dblPI;
  15.    }
  16.    Hit = 0;
  17.    if(this["P" + i].y <= 12)
  18.    {
  19.       Hit = 1;
  20.       this["P" + i].y = 12;
  21.    }
  22.    if(this["P" + i].x >= 437)
  23.    {
  24.       Hit = 2;
  25.       this["P" + i].x = 437;
  26.    }
  27.    if(this["P" + i].y >= 428)
  28.    {
  29.       Hit = 3;
  30.       this["P" + i].y = 428;
  31.    }
  32.    if(this["P" + i].x <= 12)
  33.    {
  34.       Hit = 4;
  35.       this["P" + i].x = 12;
  36.    }
  37.    if(Hit == 1 or Hit == 3)
  38.    {
  39.       this["P" + i]._xscale = 120;
  40.       this["P" + i]._yscale = 80;
  41.    }
  42.    if(Hit == 2 or Hit == 4)
  43.    {
  44.       this["P" + i]._xscale = 80;
  45.       this["P" + i]._yscale = 120;
  46.    }
  47.    if(Hit > 0)
  48.    {
  49.       AngleDiff = this["P" + i].Dir - Reflect[Hit];
  50.       this["P" + i].Dir = Reflect[Hit] - AngleDiff;
  51.    }
  52.    if(Hit == 0)
  53.    {
  54.       if(this["P" + i]._xscale > 100)
  55.       {
  56.          this["P" + i]._xscale -= 5;
  57.       }
  58.       if(this["P" + i]._xscale < 100)
  59.       {
  60.          this["P" + i]._xscale += 5;
  61.       }
  62.       if(this["P" + i]._yscale > 100)
  63.       {
  64.          this["P" + i]._yscale -= 5;
  65.       }
  66.       if(this["P" + i]._yscale < 100)
  67.       {
  68.          this["P" + i]._yscale += 5;
  69.       }
  70.    }
  71.    this["P" + i]._x = this["P" + i].x;
  72.    this["P" + i]._y = this["P" + i].y;
  73.    i++;
  74. }
  75.