home *** CD-ROM | disk | FTP | other *** search
/ 600 Games / 600games.iso / Estrategia / check.swf / scripts / DefineSprite_59 / frame_1 / DoAction.as
Encoding:
Text File  |  2006-06-13  |  1.2 KB  |  40 lines

  1. stop();
  2. this.onRelease = function()
  3. {
  4.    SqXPos = Math.round((this._y - 50) / 40 + 1);
  5.    SqYPos = Math.round((this._x - 50) / 40 + 1);
  6.    piecex = _root.matPosP[_root.activePiece[1]][_root.activePiece[2]];
  7.    xStart = _root.activePiece[1];
  8.    yStart = _root.activePiece[2];
  9.    if(_root.activePiece[1] != null)
  10.    {
  11.       if(_root.validMove(_root.activePiece[1],_root.activePiece[2],SqXPos,SqYPos))
  12.       {
  13.          valxxx = _root.playerMoveValue(xStart,yStart);
  14.          _root.movePiece(_root.activePiece[1],_root.activePiece[2],this._x,this._y);
  15.          if(_root.playerMoveValue(SqXPos,SqYPos) == 4 && valxxx == 4)
  16.          {
  17.             _root["p" + piecex]._alpha = 70;
  18.             _root.activePiece[1] = SqXPos;
  19.             _root.activePiece[2] = SqYPos;
  20.             _root.kxxxx = 1;
  21.          }
  22.          else
  23.          {
  24.             if(verifOverComp() == 1)
  25.             {
  26.                _root.gOver.play();
  27.                _root.gOver.msg.text = "You win!";
  28.             }
  29.             if(verifOverPlayer() == 1)
  30.             {
  31.                _root.gOver.play();
  32.                _root.gOver.msg.text = "You lose!";
  33.             }
  34.             _root.kxxxx = 0;
  35.             _root.computerMove();
  36.          }
  37.       }
  38.    }
  39. };
  40.