home *** CD-ROM | disk | FTP | other *** search
/ 404 Jogos / CLJG.iso / Aventura / Kung_Fu.swf / scripts / DefineSprite_1594 / frame_1 / DoAction.as
Text File  |  2007-09-26  |  1KB  |  55 lines

  1. function parseCheat(k)
  2. {
  3.    var c = 0;
  4.    while(c < cheatCodes.length)
  5.    {
  6.       if(String.fromCharCode(k).toLowerCase() != cheatCodes[c][0].toLowerCase().charAt(cheatCount[c]++))
  7.       {
  8.          cheatCount[c] = k != cheatCodes[c][0].charCodeAt(0) ? 0 : 1;
  9.       }
  10.       if(cheatCount[c] == cheatCodes[c][0].length)
  11.       {
  12.          cheatCodes[c][1].apply(null,[]);
  13.          cheatCount[c] = 0;
  14.       }
  15.       c++;
  16.    }
  17. }
  18. function func1()
  19. {
  20.    _root.specialone = "on";
  21.    _root.specialtwo = "on";
  22.    _root.specialthree = "on";
  23. }
  24. function func2()
  25. {
  26.    if(_root.jukebox == "on")
  27.    {
  28.       _root.Main.Menu.s.stop();
  29.       _root.Main.Menu.ss.stop();
  30.       _root.Main.gotoAndStop("jukebox");
  31.       trace("jukebox cheatmode activated");
  32.    }
  33. }
  34. function func3()
  35. {
  36.    if(_root.stamina == "on")
  37.    {
  38.       _root.fatigue = 100;
  39.       trace("full stamina");
  40.    }
  41. }
  42. function func4()
  43. {
  44.    trace("cheat four");
  45.    _root.powerbarthingy.gotoAndPlay(2);
  46. }
  47. cheatCodes = [["big guns",func1],["jukebox",func2],["I am poofed",func3],["full power",func4]];
  48. cheatCount = [];
  49. cheatListener = {};
  50. cheatListener.onKeyDown = function()
  51. {
  52.    parseCheat(Key.getAscii());
  53. };
  54. Key.addListener(cheatListener);
  55.