home *** CD-ROM | disk | FTP | other *** search
/ Champak 48 / cdrom_image.iso / Games / antipacman.swf / scripts / DefineSprite_204 / frame_1 / DoAction.as
Encoding:
Text File  |  2007-10-01  |  1.1 KB  |  46 lines

  1. function InitGhost(TheGhost)
  2. {
  3.    TheGhost._x = random(450);
  4.    TheGhost._y = -20;
  5.    TheGhost.Delay = random(100);
  6.    TheGhost.Fall = false;
  7.    TheGhost.N = random(4) + 1;
  8.    switch(TheGhost.N)
  9.    {
  10.       case 1:
  11.          TheGhost.R = 100;
  12.          TheGhost.G = 0;
  13.          TheGhost.B = 0;
  14.          break;
  15.       case 2:
  16.          TheGhost.R = 120;
  17.          TheGhost.G = 90;
  18.          TheGhost.B = 95;
  19.          break;
  20.       case 3:
  21.          TheGhost.R = 0;
  22.          TheGhost.G = 100;
  23.          TheGhost.B = 100;
  24.          break;
  25.       case 4:
  26.          TheGhost.R = 120;
  27.          TheGhost.G = 90;
  28.          TheGhost.B = 0;
  29.    }
  30.    TheGhost._visible = true;
  31.    TheGhost.BCol = new Color(TheGhost.Body);
  32.    TheGhost.BCol.setTransform({ra:TheGhost.R,rb:0,ga:TheGhost.G,gb:0,ba:TheGhost.B,bb:0,aa:100,ab:0});
  33.    TheGhost.Num.gotoAndStop(TheGhost.N);
  34.    TheGhost.gotoAndStop(1);
  35.    TheGhost.Speed = 2 + Math.random() * 2;
  36. }
  37. TotalGhosts = 20;
  38. cg = 1;
  39. while(cg <= TotalGhosts)
  40. {
  41.    duplicateMovieClip("GhostSample","g" + cg,16384 + this.getNextHighestDepth());
  42.    InitGhost(this["g" + cg]);
  43.    cg++;
  44. }
  45. GhostSample._visible = false;
  46.