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

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