home *** CD-ROM | disk | FTP | other *** search
/ 600 Games / 600games.iso / Estrategia / scooby.swf / scripts / DefineSprite_697 / frame_1 / DoAction.as < prev   
Encoding:
Text File  |  2006-06-13  |  3.6 KB  |  179 lines

  1. function fnShowHints()
  2. {
  3.    fnClearMessage();
  4.    Hints_mc._visible = 1;
  5.    Hints_mc.fade.gotoAndPlay(2);
  6. }
  7. function fnHideHints()
  8. {
  9.    Hints_mc._visible = 0;
  10. }
  11. function fnToggleControls(state)
  12. {
  13.    arwLeft_btn._visible = state;
  14.    arwRight_btn._visible = state;
  15. }
  16. function fnChangeCursor(item)
  17. {
  18.    if(myCursor != null)
  19.    {
  20.       sfx_mc.gotoAndPlay("AddInv");
  21.    }
  22.    else if(item != null)
  23.    {
  24.       sfx_mc.gotoAndPlay("Pickup");
  25.    }
  26.    stopDrag();
  27.    var i = 0;
  28.    while(i < crsArry.length)
  29.    {
  30.       eval("Crs_" + crsArry[i])._y = -500;
  31.       if(crsArry[i] != item and eval(crsArry[i] + "Inv") == true)
  32.       {
  33.          eval("Inv_mc.Inv" + crsArry[i] + "_mc")._visible = 1;
  34.       }
  35.       else
  36.       {
  37.          eval("Inv_mc.Inv" + crsArry[i] + "_mc")._visible = 0;
  38.       }
  39.       i++;
  40.    }
  41.    myCursor = item;
  42.    if(item != null)
  43.    {
  44.       startDrag("Crs_" + item,1);
  45.    }
  46.    if(item == "tile")
  47.    {
  48.       Crs_Tile.gotoAndStop(invTileNum);
  49.    }
  50. }
  51. function fnAddToInv(myitem)
  52. {
  53.    if(eval(myitem + "Inv") != true)
  54.    {
  55.       eval("Inv_mc.Inv" + myitem + "_mc")._visible = 1;
  56.       set(myitem + "Inv",true);
  57.       sfx_mc.gotoAndPlay("AddInv");
  58.    }
  59.    else if(myitem == "tile")
  60.    {
  61.       eval("Inv_mc.Inv" + myitem + "_mc")._visible = 1;
  62.       set(myitem + "Inv",true);
  63.       sfx_mc.gotoAndPlay("AddInv");
  64.    }
  65. }
  66. function fnRemoveInv(whichItem)
  67. {
  68.    eval("Inv_mc.Inv" + whichItem + "_mc")._visible = 0;
  69.    set(whichItem + "Inv",false);
  70.    if(myCursor == whichItem)
  71.    {
  72.       fnChangeCursor();
  73.    }
  74. }
  75. function fnChangeRoom(dir)
  76. {
  77.    AudioWalking_MC.play();
  78.    if(roomanimating != true and inPopup != true)
  79.    {
  80.       fnClearMessage();
  81.       var xTarg;
  82.       var xOff = SLIDERES;
  83.       switch(currentRoom)
  84.       {
  85.          case 1:
  86.             xOff = - SLIDERES;
  87.             xTarg = CENTERX;
  88.             currentRoom = 2;
  89.             break;
  90.          case 2:
  91.             if(dir == "right")
  92.             {
  93.                xOff = - SLIDERES;
  94.                xTarg = RIGHTX;
  95.                currentRoom = 3;
  96.             }
  97.             else
  98.             {
  99.                xTarg = LEFTX;
  100.                currentRoom = 1;
  101.             }
  102.             break;
  103.          case 3:
  104.             xTarg = CENTERX;
  105.             currentRoom = 2;
  106.       }
  107.       Fader_mc.gotoAndPlay("Dissolve");
  108.    }
  109. }
  110. function fnShowNewRoom()
  111. {
  112.    if(currentRoom == 1)
  113.    {
  114.       arwLeft_btn._visible = 0;
  115.       arwRight_btn._visible = 1;
  116.       Rooms_mc._x = LEFTX;
  117.    }
  118.    else if(currentRoom == 2)
  119.    {
  120.       arwLeft_btn._visible = 1;
  121.       arwRight_btn._visible = 1;
  122.       Rooms_mc._x = CENTERX;
  123.    }
  124.    else
  125.    {
  126.       arwLeft_btn._visible = 1;
  127.       arwRight_btn._visible = 0;
  128.       Rooms_mc._x = RIGHTX;
  129.    }
  130. }
  131. function fnMessage(textLabel)
  132. {
  133.    AudioMessage_MC.play();
  134.    Msg_mc._visible = 1;
  135.    Msg_mc.gotoAndStop(textLabel);
  136. }
  137. function fnClearMessage()
  138. {
  139.    Msg_mc._visible = 0;
  140. }
  141. _global.gPuzzleRoot = this;
  142. var CENTERX = -2;
  143. var LEFTX = 499;
  144. var RIGHTX = -502;
  145. var SLIDERES = 15;
  146. var SLIDERATE = 25;
  147. var roomanimating = false;
  148. var currentRoom = 2;
  149. var myCursor = null;
  150. var inPopup = false;
  151. crsArry = new Array();
  152. var level = 1;
  153. var eMin;
  154. var eSec;
  155. Array.prototype.searchArray = function(searchElement)
  156. {
  157.    var i = 0;
  158.    while(i < this.length)
  159.    {
  160.       if(this[i] == searchElement)
  161.       {
  162.          return i;
  163.       }
  164.       i++;
  165.    }
  166.    return null;
  167. };
  168. Array.prototype.copy = function()
  169. {
  170.    newArray = new Array();
  171.    count = 0;
  172.    while(count < this.length)
  173.    {
  174.       newArray[count] = this[count];
  175.       count++;
  176.    }
  177.    return newArray;
  178. };
  179.