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

  1. function ReverseXY(Arr)
  2. {
  3.    TA = new Array();
  4.    ya = 0;
  5.    while(ya < Arr[Arr.length - 1].length)
  6.    {
  7.       TA[ya] = new Array();
  8.       ya++;
  9.    }
  10.    xa = 0;
  11.    while(xa < Arr.length)
  12.    {
  13.       ya = 0;
  14.       while(ya <= Arr[xa].length)
  15.       {
  16.          TA[ya][xa] = Arr[xa][ya];
  17.          ya++;
  18.       }
  19.       xa++;
  20.    }
  21.    return TA;
  22. }
  23. function DrawLevel()
  24. {
  25.    dx = 0;
  26.    while(dx < Level.length)
  27.    {
  28.       dy = 0;
  29.       while(dy < Level[dx].length)
  30.       {
  31.          if(Level[dx][dy] == 1 or Level[dx][dy] == 3)
  32.          {
  33.             duplicateMovieClip(SquareSample,"S" + dx + "x" + dy,16384 + this.getNextHighestDepth());
  34.             this["S" + dx + "x" + dy]._visible = true;
  35.             this["S" + dx + "x" + dy]._x = 5 + dx * 15;
  36.             this["S" + dx + "x" + dy]._y = 5 + dy * 15;
  37.             this["S" + dx + "x" + dy].gotoAndStop(Level[dx][dy] + 1);
  38.          }
  39.          dy++;
  40.       }
  41.       dx++;
  42.    }
  43. }
  44. function RandomDirection(Char)
  45. {
  46.    StartDir = random(4) + 1;
  47.    adr = 0;
  48.    while(adr <= 3)
  49.    {
  50.       CheckDir = StartDir + adr;
  51.       if(CheckDir > 4)
  52.       {
  53.          CheckDir -= 4;
  54.       }
  55.       if(Level[Char.SquareX + DirsX[CheckDir]][Char.SquareY + DirsY[CheckDir]] != 2)
  56.       {
  57.          Char.Dir = CheckDir;
  58.          break;
  59.       }
  60.       adr++;
  61.    }
  62. }
  63. function FillMatrix(X, Y)
  64. {
  65.    var _loc2_ = undefined;
  66.    var _loc1_ = undefined;
  67.    BusyArr = new Array();
  68.    DirsPref = new Array();
  69.    fd = 1;
  70.    while(fd <= 4)
  71.    {
  72.       DirsPref[fd] = {};
  73.       fd++;
  74.    }
  75.    _loc2_ = 0;
  76.    while(_loc2_ < Level.length)
  77.    {
  78.       BusyArr[_loc2_] = [];
  79.       _loc2_ = _loc2_ + 1;
  80.    }
  81.    MaxLevels = 10;
  82.    FreeSquares = new Array();
  83.    FreeSquares.push({x:X,y:Y,Level:0,OD:0});
  84.    while(FreeSquares.length > 0)
  85.    {
  86.       CurrSquare = FreeSquares.shift();
  87.       if(CurrSquare.x == 29 and CurrSquare.y == 15)
  88.       {
  89.          CurrSquare.x = 0;
  90.       }
  91.       else if(CurrSquare.x == 0 and CurrSquare.y == 15)
  92.       {
  93.          CurrSquare.x = 29;
  94.       }
  95.       BusyArr[CurrSquare.x][CurrSquare.y] = CurrSquare.Level + "-" + CurrSquare.OD;
  96.       switch(Level[CurrSquare.x][CurrSquare.y])
  97.       {
  98.          case 1:
  99.             if(DirsPref[CurrSquare.OD].Dot == undefined)
  100.             {
  101.                DirsPref[CurrSquare.OD].Dot = CurrSquare.Level;
  102.             }
  103.             break;
  104.          case 3:
  105.             if(DirsPref[CurrSquare.OD].Blue == undefined)
  106.             {
  107.                DirsPref[CurrSquare.OD].Blue = CurrSquare.Level;
  108.             }
  109.       }
  110.       fg = 1;
  111.       while(fg <= GhostsNum)
  112.       {
  113.          if(DirsPref[CurrSquare.OD].Ghost == undefined and Characters[fg].SquareX == CurrSquare.x and Characters[fg].SquareY == CurrSquare.y and !Characters[fg].Dead)
  114.          {
  115.             DirsPref[CurrSquare.OD].Ghost = CurrSquare.Level;
  116.             if(fg == UnderControl)
  117.             {
  118.                DirsPref[CurrSquare.OD].GhostUnderControl = true;
  119.             }
  120.             else
  121.             {
  122.                DirsPref[CurrSquare.OD].GhostUnderControl = false;
  123.             }
  124.          }
  125.          fg++;
  126.       }
  127.       if(CurrSquare.Level < MaxLevels)
  128.       {
  129.          _loc1_ = 1;
  130.          while(_loc1_ <= 4)
  131.          {
  132.             NextSquareX = CurrSquare.x + DirsX[_loc1_];
  133.             NextSquareY = CurrSquare.y + DirsY[_loc1_];
  134.             if(NextSquareX >= 0 and NextSquareX < Level.length and NextSquareY >= 0 and NextSquareY < Level[0].length and Level[CurrSquare.x + DirsX[_loc1_]][CurrSquare.y + DirsY[_loc1_]] != 2 and Level[CurrSquare.x + DirsX[_loc1_]][CurrSquare.y + DirsY[_loc1_]] != 4 and BusyArr[NextSquareX][NextSquareY] == undefined)
  135.             {
  136.                if(CurrSquare.Level == 0)
  137.                {
  138.                   OD = _loc1_;
  139.                }
  140.                else
  141.                {
  142.                   OD = CurrSquare.OD;
  143.                }
  144.                FreeSquares.push({x:NextSquareX,y:NextSquareY,Level:CurrSquare.Level + 1,OD:OD});
  145.             }
  146.             _loc1_ = _loc1_ + 1;
  147.          }
  148.       }
  149.    }
  150.    var _loc6_ = undefined;
  151.    _loc6_ = Characters[0].CameFrom + 2;
  152.    if(_loc6_ > 4)
  153.    {
  154.       _loc6_ -= 4;
  155.    }
  156.    pd = 1;
  157.    while(pd <= 4)
  158.    {
  159.       if(DirsPref[pd].Dot == undefined and DirsPref[pd].Ghost == undefined and DirsPref[pd].Blue == undefined)
  160.       {
  161.          DirsPref[pd].Zero = true;
  162.       }
  163.       else
  164.       {
  165.          DirsPref[pd].Zero = false;
  166.       }
  167.       if(DirsPref[pd].Dot == undefined)
  168.       {
  169.          DirsPref[pd].Dot = MaxLevels;
  170.       }
  171.       if(DirsPref[pd].Ghost == undefined)
  172.       {
  173.          DirsPref[pd].Ghost = MaxLevels;
  174.       }
  175.       if(DirsPref[pd].Blue == undefined)
  176.       {
  177.          DirsPref[pd].Blue = MaxLevels;
  178.       }
  179.       if(DirsPref[pd].GhostUnderControl)
  180.       {
  181.          Mult = 2;
  182.       }
  183.       else
  184.       {
  185.          Mult = 1;
  186.       }
  187.       if(pd == _loc6_)
  188.       {
  189.          Red = 10;
  190.       }
  191.       else
  192.       {
  193.          Red = 0;
  194.       }
  195.       if(!GhostsBlue)
  196.       {
  197.          DirsPref[pd].Score = MaxLevels - DirsPref[pd].Dot - (MaxLevels - DirsPref[pd].Ghost) * 20 * Mult + (MaxLevels - DirsPref[pd].Blue) * 10 - Red;
  198.       }
  199.       else
  200.       {
  201.          DirsPref[pd].Score = MaxLevels - DirsPref[pd].Dot + (MaxLevels - DirsPref[pd].Ghost) * 20 / Mult - (MaxLevels - DirsPref[pd].Blue) * 10 - Red;
  202.       }
  203.       pd++;
  204.    }
  205. }
  206. function FillGhostMatrix(ind, X, Y)
  207. {
  208.    var _loc2_ = undefined;
  209.    var _loc1_ = undefined;
  210.    BusyArr = new Array();
  211.    DirsPref = new Array();
  212.    fd = 1;
  213.    while(fd <= 4)
  214.    {
  215.       DirsPref[fd] = {};
  216.       fd++;
  217.    }
  218.    _loc2_ = 0;
  219.    while(_loc2_ < Level.length)
  220.    {
  221.       BusyArr[_loc2_] = [];
  222.       _loc2_ = _loc2_ + 1;
  223.    }
  224.    MaxLevels = 10;
  225.    FreeSquares = new Array();
  226.    FreeSquares.push({x:X,y:Y,Level:0,OD:0});
  227.    while(FreeSquares.length > 0)
  228.    {
  229.       CurrSquare = FreeSquares.shift();
  230.       if(CurrSquare.x == 29 and CurrSquare.y == 15)
  231.       {
  232.          CurrSquare.x = 0;
  233.       }
  234.       else if(CurrSquare.x == 0 and CurrSquare.y == 15)
  235.       {
  236.          CurrSquare.x = 29;
  237.       }
  238.       BusyArr[CurrSquare.x][CurrSquare.y] = CurrSquare.Level + "-" + CurrSquare.OD;
  239.       if(DirsPref[CurrSquare.OD].Ghost == undefined and Characters[0].SquareX == CurrSquare.x and Characters[0].SquareY == CurrSquare.y and !Characters[0].Dead)
  240.       {
  241.          DirsPref[CurrSquare.OD].Score = CurrSquare.Level * 10;
  242.       }
  243.       if(CurrSquare.Level < MaxLevels)
  244.       {
  245.          _loc1_ = 1;
  246.          while(_loc1_ <= 4)
  247.          {
  248.             NextSquareX = CurrSquare.x + DirsX[_loc1_];
  249.             NextSquareY = CurrSquare.y + DirsY[_loc1_];
  250.             if(NextSquareX >= 0 and NextSquareX < Level.length and NextSquareY >= 0 and NextSquareY < Level[0].length and Level[CurrSquare.x + DirsX[_loc1_]][CurrSquare.y + DirsY[_loc1_]] != 2 and BusyArr[NextSquareX][NextSquareY] == undefined)
  251.             {
  252.                if(CurrSquare.Level == 0)
  253.                {
  254.                   OD = _loc1_;
  255.                }
  256.                else
  257.                {
  258.                   OD = CurrSquare.OD;
  259.                }
  260.                FreeSquares.push({x:NextSquareX,y:NextSquareY,Level:CurrSquare.Level + 1,OD:OD});
  261.             }
  262.             _loc1_ = _loc1_ + 1;
  263.          }
  264.       }
  265.    }
  266.    var _loc6_ = undefined;
  267.    _loc6_ = Characters[ind].CameFrom + 2;
  268.    if(_loc6_ > 4)
  269.    {
  270.       _loc6_ -= 4;
  271.    }
  272.    pd = 1;
  273.    while(pd <= 4)
  274.    {
  275.       if(DirsPref[pd].Score == undefined)
  276.       {
  277.          DirsPref[pd].Score = 0;
  278.          DirsPref[pd].Zero = true;
  279.       }
  280.       else
  281.       {
  282.          DirsPref[pd].Zero = false;
  283.          DirsPref[pd].Score = (MaxLevels + 1) * 10 - DirsPref[pd].Score;
  284.       }
  285.       if(GhostsBlue)
  286.       {
  287.          DirsPref[pd].Score = - DirsPref[pd].Score;
  288.       }
  289.       if(pd == _loc6_)
  290.       {
  291.          DirsPref[pd].Score -= 10;
  292.       }
  293.       pd++;
  294.    }
  295. }
  296. function FindDir(ind, FromX, FromY, ToX, ToY)
  297. {
  298.    var _loc2_ = new Array();
  299.    if(Math.abs(FromX - ToX) > Math.abs(FromY - ToY))
  300.    {
  301.       if(ToX > FromX)
  302.       {
  303.          _loc2_.push(2);
  304.       }
  305.       else
  306.       {
  307.          _loc2_.push(4);
  308.       }
  309.    }
  310.    else if(ToY > FromY)
  311.    {
  312.       _loc2_.push(3);
  313.    }
  314.    else
  315.    {
  316.       _loc2_.push(1);
  317.    }
  318.    if(Math.abs(FromX - ToX) > Math.abs(FromY - ToY))
  319.    {
  320.       if(ToY > FromY)
  321.       {
  322.          _loc2_.push(3);
  323.       }
  324.       else
  325.       {
  326.          _loc2_.push(1);
  327.       }
  328.    }
  329.    else if(ToX > FromX)
  330.    {
  331.       _loc2_.push(2);
  332.    }
  333.    else
  334.    {
  335.       _loc2_.push(4);
  336.    }
  337.    if(Math.abs(FromX - ToX) > Math.abs(FromY - ToY))
  338.    {
  339.       if(ToY > FromY)
  340.       {
  341.          _loc2_.push(1);
  342.       }
  343.       else
  344.       {
  345.          _loc2_.push(3);
  346.       }
  347.    }
  348.    else if(ToX > FromX)
  349.    {
  350.       _loc2_.push(4);
  351.    }
  352.    else
  353.    {
  354.       _loc2_.push(2);
  355.    }
  356.    if(Math.abs(FromX - ToX) > Math.abs(FromY - ToY))
  357.    {
  358.       if(ToX > FromX)
  359.       {
  360.          _loc2_.push(4);
  361.       }
  362.       else
  363.       {
  364.          _loc2_.push(2);
  365.       }
  366.    }
  367.    else if(ToY > FromY)
  368.    {
  369.       _loc2_.push(1);
  370.    }
  371.    else
  372.    {
  373.       _loc2_.push(3);
  374.    }
  375.    var _loc1_ = undefined;
  376.    var _loc5_ = undefined;
  377.    _loc5_ = Characters[ind].CameFrom + 2;
  378.    if(_loc5_ > 4)
  379.    {
  380.       _loc5_ -= 4;
  381.    }
  382.    _loc1_ = 0;
  383.    while(_loc1_ <= 3)
  384.    {
  385.       if(_loc2_[_loc1_] != _loc5_ and Level[FromX + DirsX[_loc2_[_loc1_]]][FromY + DirsY[_loc2_[_loc1_]]] != 2 and (ind != 0 or Level[FromX + DirsX[_loc2_[_loc1_]]][FromY + DirsY[_loc2_[_loc1_]]] != 4))
  386.       {
  387.          return _loc2_[_loc1_];
  388.       }
  389.       _loc1_ = _loc1_ + 1;
  390.    }
  391. }
  392. function TurnGhostsBlue()
  393. {
  394.    fd = 1;
  395.    while(fd <= GhostsNum)
  396.    {
  397.       Characters[fd].Fading = true;
  398.       Characters[fd].FadeDir = 1;
  399.       if(!GhostsBlue)
  400.       {
  401.          Characters[fd].FadeCounter = 0;
  402.       }
  403.       fd++;
  404.    }
  405.    GhostsBlue = true;
  406.    BlueCounter = 0;
  407. }
  408. function UpdateIndicator(Ind, Par)
  409. {
  410.    StrRep = String(Par);
  411.    dg = 0;
  412.    while(dg <= 10)
  413.    {
  414.       if(dg < StrRep.length)
  415.       {
  416.          Ind["d" + dg]._visible = true;
  417.          if(StrRep.charAt(dg) == "-")
  418.          {
  419.             Ind["d" + dg].gotoAndStop(11);
  420.          }
  421.          else
  422.          {
  423.             Ind["d" + dg].gotoAndStop(Number(StrRep.charAt(dg)) + 1);
  424.          }
  425.       }
  426.       else
  427.       {
  428.          Ind["d" + dg]._visible = false;
  429.       }
  430.       dg++;
  431.    }
  432.    if(Ind != LivesInd)
  433.    {
  434.       Ind._x = 380 - StrRep.length * 10;
  435.    }
  436. }
  437. function AddLevelScore()
  438. {
  439.    _parent.Score += 800 + _parent.CurrLevel * 200;
  440. }
  441. Level = [[2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2],[2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2],[2,2,1,1,1,1,1,1,1,1,1,1,1,1,2,2,1,1,1,1,1,1,1,1,1,1,1,1,2,2],[2,2,1,2,2,2,2,1,2,2,2,2,2,1,2,2,1,2,2,2,2,2,1,2,2,2,2,1,2,2],[2,2,3,2,2,2,2,1,2,2,2,2,2,1,2,2,1,2,2,2,2,2,1,2,2,2,2,3,2,2],[2,2,1,2,2,2,2,1,2,2,2,2,2,1,2,2,1,2,2,2,2,2,1,2,2,2,2,1,2,2],[2,2,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,2,2],[2,2,1,2,2,2,2,1,2,2,1,2,2,2,2,2,2,2,2,1,2,2,1,2,2,2,2,1,2,2],[2,2,1,2,2,2,2,1,2,2,1,2,2,2,2,2,2,2,2,1,2,2,1,2,2,2,2,1,2,2],[2,2,1,1,1,1,1,1,2,2,1,1,1,1,2,2,1,1,1,1,2,2,1,1,1,1,1,1,2,2],[2,2,2,2,2,2,2,1,2,2,2,2,2,0,2,2,0,2,2,2,2,2,1,2,2,2,2,2,2,2],[2,2,2,2,2,2,2,1,2,2,2,2,2,0,2,2,0,2,2,2,2,2,1,2,2,2,2,2,2,2],[2,2,2,2,2,2,2,1,2,2,0,0,0,0,0,0,0,0,0,0,2,2,1,2,2,2,2,2,2,2],[2,2,2,2,2,2,2,1,2,2,0,2,2,2,4,4,2,2,2,0,2,2,1,2,2,2,2,2,2,2],[2,2,2,2,2,2,2,1,2,2,0,2,2,2,4,4,2,2,2,0,2,2,1,2,2,2,2,2,2,2],[0,0,0,0,0,0,0,1,0,0,0,2,2,0,0,0,0,2,2,0,0,0,1,0,0,0,0,0,0,0],[2,2,2,2,2,2,2,1,2,2,0,2,2,2,2,2,2,2,2,0,2,2,1,2,2,2,2,2,2,2],[2,2,2,2,2,2,2,1,2,2,0,2,2,2,2,2,2,2,2,0,2,2,1,2,2,2,2,2,2,2],[2,2,2,2,2,2,2,1,2,2,0,0,0,0,0,0,0,0,0,0,2,2,1,2,2,2,2,2,2,2],[2,2,2,2,2,2,2,1,2,2,0,2,2,2,2,2,2,2,2,0,2,2,1,2,2,2,2,2,2,2],[2,2,2,2,2,2,2,1,2,2,0,2,2,2,2,2,2,2,2,0,2,2,1,2,2,2,2,2,2,2],[2,2,1,1,1,1,1,1,1,1,1,1,1,1,2,2,1,1,1,1,1,1,1,1,1,1,1,1,2,2],[2,2,1,2,2,2,2,1,2,2,2,2,2,1,2,2,1,2,2,2,2,2,1,2,2,2,2,1,2,2],[2,2,1,2,2,2,2,1,2,2,2,2,2,1,2,2,1,2,2,2,2,2,1,2,2,2,2,1,2,2],[2,2,3,1,1,2,2,1,1,1,1,1,1,1,1,0,1,1,1,1,1,1,1,2,2,1,1,3,2,2],[2,2,2,2,1,2,2,1,2,2,1,2,2,2,2,2,2,2,2,1,2,2,1,2,2,1,2,2,2,2],[2,2,2,2,1,2,2,1,2,2,1,2,2,2,2,2,2,2,2,1,2,2,1,2,2,1,2,2,2,2],[2,2,1,1,1,1,1,1,2,2,1,1,1,1,2,2,1,1,1,1,2,2,1,1,1,1,1,1,2,2],[2,2,1,2,2,2,2,2,2,2,2,2,2,1,2,2,1,2,2,2,2,2,2,2,2,2,2,1,2,2],[2,2,1,2,2,2,2,2,2,2,2,2,2,1,2,2,1,2,2,2,2,2,2,2,2,2,2,1,2,2],[2,2,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,2,2],[2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2],[2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2]];
  442. DirsX = [0,0,1,0,-1];
  443. DirsY = [0,-1,0,1,0];
  444. EatDot = new Sound(this);
  445. EatDot.attachSound("EATDOT");
  446. BigDot = new Sound(this);
  447. BigDot.attachSound("BIGDOT");
  448. PacmanDie = new Sound(this);
  449. PacmanDie.attachSound("PACMANDIE");
  450. GhostDie = new Sound(this);
  451. GhostDie.attachSound("GHOSTDIE");
  452. EatBonus = new Sound(this);
  453. EatBonus.attachSound("EATBONUS");
  454. if(_parent.MusicOn)
  455. {
  456.    _parent.Music.start(0,1000000000);
  457. }
  458. Paused = false;
  459. Characters = new Array();
  460. switch(_parent.CurrLevel)
  461. {
  462.    case 1:
  463.       GhostsNum = 4;
  464.       MoveSpeed = 3;
  465.       Mode = 1;
  466.       break;
  467.    case 2:
  468.       GhostsNum = 3;
  469.       MoveSpeed = 3;
  470.       Mode = 1;
  471.       break;
  472.    case 3:
  473.       GhostsNum = 2;
  474.       MoveSpeed = 3;
  475.       Mode = 1;
  476.       break;
  477.    case 4:
  478.       GhostsNum = 4;
  479.       MoveSpeed = 5;
  480.       Mode = 1;
  481.       break;
  482.    case 5:
  483.       GhostsNum = 3;
  484.       MoveSpeed = 5;
  485.       Mode = 1;
  486.       break;
  487.    case 6:
  488.       GhostsNum = 2;
  489.       MoveSpeed = 5;
  490.       Mode = 1;
  491.       break;
  492.    case 7:
  493.       GhostsNum = 2;
  494.       MoveSpeed = 3;
  495.       Mode = 2;
  496.       break;
  497.    case 8:
  498.       GhostsNum = 3;
  499.       MoveSpeed = 3;
  500.       Mode = 2;
  501.       break;
  502.    case 9:
  503.       GhostsNum = 4;
  504.       MoveSpeed = 3;
  505.       Mode = 2;
  506.       break;
  507.    case 10:
  508.       GhostsNum = 2;
  509.       MoveSpeed = 5;
  510.       Mode = 2;
  511.       break;
  512.    case 11:
  513.       GhostsNum = 3;
  514.       MoveSpeed = 5;
  515.       Mode = 2;
  516.       break;
  517.    case 12:
  518.       GhostsNum = 4;
  519.       MoveSpeed = 5;
  520.       Mode = 2;
  521. }
  522. LivesInd.Sign.gotoAndStop(Mode);
  523. _parent.GameMode = Mode;
  524. if(Mode == 1)
  525. {
  526.    BlueTime = 200 + _parent.CurrLevel * (60 / MoveSpeed);
  527. }
  528. else
  529. {
  530.    BlueTime = 200 - _parent.CurrLevel * 2 * MoveSpeed;
  531. }
  532. if(Mode == 1)
  533. {
  534.    LevelRep = 7 - _parent.CurrLevel;
  535. }
  536. else
  537. {
  538.    LevelRep = _parent.CurrLevel - 6;
  539. }
  540. BonusOut = false;
  541. BonusCounter = 0;
  542. AnyGhostsAlive = true;
  543. if(Mode == 2)
  544. {
  545.    UnderControl = 0;
  546. }
  547. else
  548. {
  549.    UnderControl = 1;
  550. }
  551. init = 0;
  552. while(init <= GhostsNum)
  553. {
  554.    Characters[init] = new Object();
  555.    Characters[init].UnderControl = false;
  556.    if(init == 0)
  557.    {
  558.       Characters[init].x = 225;
  559.       Characters[init].y = 360;
  560.       Characters[init].SquareX = 15;
  561.       Characters[init].SquareY = 24;
  562.       if(Mode == 2)
  563.       {
  564.          Characters[init].Dir = 0;
  565.       }
  566.       else
  567.       {
  568.          Characters[init].Dir = 2;
  569.       }
  570.    }
  571.    else
  572.    {
  573.       Characters[init].x = (12 + init) * 15;
  574.       Characters[init].y = 225;
  575.       Characters[init].SquareX = 12 + init;
  576.       Characters[init].SquareY = 15;
  577.       Characters[init].Dir = 2;
  578.    }
  579.    switch(init)
  580.    {
  581.       case 1:
  582.          Characters[init].R = 100;
  583.          Characters[init].G = 0;
  584.          Characters[init].B = 0;
  585.          break;
  586.       case 2:
  587.          Characters[init].R = 120;
  588.          Characters[init].G = 90;
  589.          Characters[init].B = 95;
  590.          break;
  591.       case 3:
  592.          Characters[init].R = 0;
  593.          Characters[init].G = 100;
  594.          Characters[init].B = 100;
  595.          break;
  596.       case 4:
  597.          Characters[init].R = 120;
  598.          Characters[init].G = 90;
  599.          Characters[init].B = 0;
  600.    }
  601.    init++;
  602. }
  603. GhostsBlue = false;
  604. EatenDots = 0;
  605. Level = ReverseXY(Level);
  606. DrawLevel();
  607. SquareSample._visible = false;
  608. PacmanSample._visible = false;
  609. GhostSample._visible = false;
  610. duplicateMovieClip(PacmanSample,"Pacman",16384 + this.getNextHighestDepth());
  611. duplicateMovieClip(PacmanSample,"PacmanCopy",16384 + this.getNextHighestDepth());
  612. g = 1;
  613. while(g <= GhostsNum)
  614. {
  615.    duplicateMovieClip(GhostSample,"G" + g,16384 + this.getNextHighestDepth());
  616.    duplicateMovieClip(GhostSample,"G" + g + "Copy",16384 + this.getNextHighestDepth());
  617.    Characters[g].Symbol = this["G" + g];
  618.    Characters[g].Copy = this["G" + g + "Copy"];
  619.    Characters[g].Symbol.Num.gotoAndStop(g);
  620.    Characters[g].BCol = new Color(this["G" + g].Body);
  621.    Characters[g].BCol.setTransform({ra:Characters[g].R,rb:0,ga:Characters[g].G,gb:0,ba:Characters[g].B,bb:0,aa:100,ab:0});
  622.    Characters[g].NCol = new Color(this["G" + g].Num);
  623.    Characters[g].CBCol = new Color(this["G" + g + "Copy"].Body);
  624.    Characters[g].CBCol.setTransform({ra:Characters[g].R,rb:0,ga:Characters[g].G,gb:0,ba:Characters[g].B,bb:0,aa:100,ab:0});
  625.    Characters[g].CNCol = new Color(this["G" + g + "Copy"].Num);
  626.    g++;
  627. }
  628. Characters[0].Symbol = Pacman;
  629. Characters[0].Copy = PacmanCopy;
  630. if(Mode == 2)
  631. {
  632.    Characters[0].Symbol.gotoAndStop(4);
  633.    Characters[0].Symbol.Inside.gotoAndStop(3);
  634.    Characters[0].Symbol.Eye.gotoAndStop(3);
  635. }
  636. TP._visible = true;
  637. TP.swapDepths(this.getNextHighestDepth());
  638. init = 1;
  639. while(init <= 4)
  640. {
  641.    if(init <= GhostsNum)
  642.    {
  643.       this["GI" + init]._visible = true;
  644.       this["GI" + init].BCol = new Color(this["GI" + init].Body);
  645.       this["GI" + init].BCol.setTransform({ra:Characters[init].R,rb:0,ga:Characters[init].G,gb:0,ba:Characters[init].B,bb:0,aa:100,ab:0});
  646.       this["GI" + init].NCol = new Color(this["GI" + init].Num);
  647.       this["GI" + init].NCol.setTransform({ra:Characters[init].R,rb:0,ga:Characters[init].G,gb:0,ba:Characters[init].B,bb:0,aa:100,ab:0});
  648.       this["GI" + init].Num.gotoAndStop(init);
  649.    }
  650.    else
  651.    {
  652.       this["GI" + init]._visible = false;
  653.    }
  654.    init++;
  655. }
  656. PauseScreenSample.duplicateMovieClip("PauseScreen",this.getNextHighestDepth());
  657. PauseScreenSample._visible = false;
  658. PauseScreen.gotoAndStop(1);
  659.