Game_Logic

Fire! Fun Money Clicker!

Jan 13th, 2020 (edited)
183
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.44 KB | None | 0 0
  1. document.body.innerHTML = "<big>Fire! </big><a>Reach $250 to win! $-15 to lose!<div><a id='ans'>Press Fire! to start!</a><div><button onclick='fire(); testwin()'>Fire! [$0] [Bet $1]</button><div><button onclick='missile(); testwin()'>Fire Missile! [$50] [Bet $50]</button></div><button onclick='nuke(); testwin()'>Fire Nuke! [$150] [Bet $150]</button><div><a>$</a><a id='money'>0</a></div><div><img id='ansimg'></img></div><small>Made by Game_Logic"; function fire() { var nums = ['Miss! $-1','Hit! $+1','Hit! $+1']; var ans = ((nums[Math.floor(Math.random() * nums.length)].toString())); document.getElementById('ans').innerHTML = ans; if (document.getElementById('ans').innerHTML == "Hit! $+1") { document.getElementById('money').innerHTML = Number(document.getElementById('money').innerHTML)+Number(1); document.getElementById('ansimg').src="https://as2.ftcdn.net/jpg/01/15/29/69/500_F_115296942_CCpTTvRdrbWqVw6SPNr4rbvuU5v2rKFt.jpg"; } else { document.getElementById('money').innerHTML = Number(document.getElementById('money').innerHTML)-Number(1); document.getElementById('ansimg').src="https://images-na.ssl-images-amazon.com/images/I/31nGqnlqhlL._SX425_.jpg"; }; };
  2. function missile() { if(document.getElementById('money').innerHTML > 49) { document.getElementById('money').innerHTML = Number(document.getElementById('money').innerHTML)-Number(25); var nums = ['Miss! $-50','Hit! $+50']; var ans = ((nums[Math.floor(Math.random() * nums.length)].toString())); document.getElementById('ans').innerHTML = ans; if (document.getElementById('ans').innerHTML == "Hit! $+50") { document.getElementById('money').innerHTML = Number(document.getElementById('money').innerHTML)+Number(75); document.getElementById('ansimg').src = "https://a57.foxnews.com/media2.foxnews.com/BrightCove/694940094001/2020/01/08/931/524/694940094001_6120762190001_6120762843001-vs.jpg?ve=1&tl=1"; } else { document.getElementById('money').innerHTML = Number(document.getElementById('money').innerHTML)-Number(50); document.getElementById('ansimg').src = "https://resize.hswstatic.com/w_907/gif/hyper-sonic.jpg"; }; }; };
  3. function nuke() { if(document.getElementById('money').innerHTML > 149) { document.getElementById('money').innerHTML = Number(document.getElementById('money').innerHTML)-Number(150); var nums = ['Miss! $-150','Hit! $+150']; var ans = ((nums[Math.floor(Math.random() * nums.length)].toString())); document.getElementById('ans').innerHTML = ans; if (document.getElementById('ans').innerHTML == "Hit! $+150") { document.getElementById('money').innerHTML = Number(document.getElementById('money').innerHTML)+Number(300); } else { document.getElementById('money').innerHTML = Number(document.getElementById('money').innerHTML)-Number(150); }; }; };;
  4. function testwin() { if(document.getElementById('money').innerHTML > 249) { document.body.innerHTML = "<img src='http://pixelartmaker.com/art/d1e16859c09183b.png'></img>"; alert('Hit!'); }; if(document.getElementById('money').innerHTML < -14) { document.body.innerHTML = "<img src='http://pixelartmaker.com/art/8d3202a41dfe82e.png'></img>"; alert('Miss!'); }; };
  5. addEventListener('keydown',checkKey,false)
  6.  
  7. function checkKey(evt) { if(evt.keyCode == 17) { document.body.innerHTML = "<big style='color:red;font-size:50;'>NO CHEATING!</big>"; }; };
  8. addEventListener('keyup',checkKey2,false)
  9.  
  10. function checkKey2(evt) { if(evt.keyCode == 9) { document.body.innerHTML = "<big style='color:red;font-size:50;'>NO CHEATING!</big>"; }; }; document.title = "Fire! HTML5 Game!";
Add Comment
Please, Sign In to add comment