home *** CD-ROM | disk | FTP | other *** search
/ 404 Jogos / CLJG.iso / Diversos / hedgehog-launch.swf / scripts / DefineSprite_130_victoryScreen / frame_20 / DoAction.as
Encoding:
Text File  |  2008-09-11  |  2.0 KB  |  73 lines

  1. function cleanUpMoney(num)
  2. {
  3.    gotta = Math.round((Math.floor(num * 100) / 100 - Math.floor(num)) * 100);
  4.    if(gotta == 0)
  5.    {
  6.       return Math.floor(num) + ".00";
  7.    }
  8.    if(gotta % 10 == 0)
  9.    {
  10.       return Math.floor(num) + "." + gotta;
  11.    }
  12.    return Math.floor(num) + "." + gotta;
  13. }
  14. totalElevationBonus = Math.floor(_root.levelElevation * 10 / 100) / 10;
  15. runTimeBonus = Math.floor((10 + (_root.seconds + _root.minutes * 60)) / 10);
  16. totalMoney = _root.levelCash * totalElevationBonus * runTimeBonus;
  17. countStage = 0;
  18. counter = 0;
  19. monDiv = _root.levelCash / 50;
  20. trace("------------");
  21. trace(_root.totalCash);
  22. _root.totalCash += totalMoney;
  23. trace(_root.totalCash);
  24. onEnterFrame = function()
  25. {
  26.    switch(countStage)
  27.    {
  28.       case 0:
  29.          counter += monDiv;
  30.          tiger.text = "$" + cleanUpMoney(counter);
  31.          if(counter >= _root.levelCash)
  32.          {
  33.             tiger.text = "$" + cleanUpMoney(_root.levelCash);
  34.             monDiv = totalElevationBonus / 30;
  35.             counter = 0;
  36.             countStage = 1;
  37.          }
  38.          break;
  39.       case 1:
  40.          counter += monDiv;
  41.          bear.text = "x" + cleanUpMoney(counter);
  42.          if(counter >= totalElevationBonus)
  43.          {
  44.             bear.text = "x" + cleanUpMoney(totalElevationBonus);
  45.             monDiv = runTimeBonus / 30;
  46.             counter = 0;
  47.             countStage = 2;
  48.          }
  49.          break;
  50.       case 2:
  51.          counter += monDiv;
  52.          moxre.text = "x" + cleanUpMoney(counter);
  53.          if(counter >= runTimeBonus)
  54.          {
  55.             moxre.text = "x" + cleanUpMoney(runTimeBonus);
  56.             monDiv = totalMoney / 30;
  57.             counter = 0;
  58.             countStage = 3;
  59.          }
  60.          break;
  61.       case 3:
  62.          counter += monDiv;
  63.          toal.text = "$" + cleanUpMoney(counter) + " Total";
  64.          if(counter >= totalMoney)
  65.          {
  66.             toal.text = "$" + cleanUpMoney(totalMoney) + " Total";
  67.             countStage = 4;
  68.          }
  69.          break;
  70.       case 4:
  71.    }
  72. };
  73.