Advertisement
Guest User

Untitled

a guest
Nov 12th, 2013
161
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. var curAmntLogs = 1000.00;
  2. var curAmntClay = 1000.00;
  3. var curAmntMetal = 1000.00;
  4.  
  5. var maxResources = 1000;
  6.  
  7. var curLogsPerSec = 1.67;
  8. var curClayPerSec = 1.67;
  9. var curMetalPerSec = 1.67;
  10.  
  11. function logs() {
  12.     curAmntLogs = curAmntLogs + curLogsPerSec;
  13.     if (curAmntLogs > maxResources) {
  14.   curAmntLogs = maxResources;
  15.   document.getElementById('logs').innerHTML = '<strong>' + (curAmntLogs).toFixed(2) + '</strong>';
  16.     } else {
  17.   document.getElementById('logs').innerHTML = (curAmntLogs).toFixed(2);
  18.     }
  19. }
  20.  
  21. function clay() {
  22.     curAmntClay = curAmntClay + curClayPerSec;
  23.     if (curAmntClay > maxResources) {
  24.   curAmntClay = maxResources;
  25.   document.getElementById('clay').innerHTML = '<strong>' + (curAmntClay).toFixed(2) + '</strong>';
  26.     } else {
  27.   document.getElementById('clay').innerHTML = (curAmntClay).toFixed(2);
  28.     }
  29. }
  30.  
  31. function metal() {
  32.     curAmntMetal = curAmntMetal + curMetalPerSec;
  33.     if (curAmntMetal > maxResources) {
  34.   curAmntMetal = maxResources;
  35.   document.getElementById('metal').innerHTML = '<strong>' + (curAmntMetal).toFixed(2) + '</strong>';
  36.     } else {
  37.   document.getElementById('metal').innerHTML = (curAmntMetal).toFixed(2);
  38.     }
  39. }
  40.  
  41. setInterval(function(){ logs(); clay(); metal(); }, 1000);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement