Advertisement
Guest User

spaghet

a guest
Oct 22nd, 2018
76
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.44 KB | None | 0 0
  1. <!DOCTYPE html>
  2. <html>
  3. <body>
  4.  
  5.  
  6. <body onload ="setTimeout(startTextFunc(), 100)">
  7.  
  8. <button id = "continueButton" onclick ="setTimeout(startTextFunc, 100)">continue</button>
  9. <button id = "woodButton" onclick ="mineWood()">Get Wood</button>
  10. <button id = "yesStoolButton" onclick ="yesStool()">Make Stool</button>
  11. <button id = "noStoolButton" onclick ="noStool()">Kill Stool</button>
  12.  
  13. <p id="startStory1"></p>
  14. <p id="startStory2"></p>
  15. <p id="woodCounter"></p>
  16. <p id="stoolCounter"></p>
  17. <p id="glueCounter"></p>
  18. <p id="nailCounter"></p>
  19. <p id="failText"></p>
  20.  
  21.  
  22. <script>
  23. //Variables
  24. let stoolCount = 0;
  25.  
  26. let woodResource = 0
  27. let glueResource = 0
  28. let nailResource = 10
  29. let steelResource = 0
  30. let nailReveal = 0
  31. let glueReveal = 0
  32. let matsfailtxt = "You have not enough materials!"
  33. let structuresfailtxt = "You have not enough structures!"
  34.  
  35. document.getElementById("woodCounter").innerHTML= woodResource + " wood";
  36. document.getElementById("noStoolButton").style.visibility= 'hidden';
  37.  
  38. function mineWood() {
  39. woodResource = woodResource + 1
  40. document.getElementById("woodCounter").innerHTML= woodResource + " wood";
  41. }
  42.  
  43. function yesStool() {
  44. if (woodResource >= 50 && glueResource >= 5) {
  45. woodResource = woodResource - 50
  46. stoolCount = stoolCount + 1
  47. glueResource = glueResource - 5
  48. document.getElementById("glueCounter").innerHTML= glueResource + " glue";
  49. document.getElementById("stoolCounter").innerHTML= stoolCount + " stools";
  50. document.getElementById("noStoolButton").style.visibility= 'visible';
  51. } else if (woodResource >= 50 && glueReveal == 0) {
  52. glueReveal = 1
  53. glueResource = 15
  54. alert("The wood quickly falls apart as you try to assemble a stool. Luckily, You have a bottle of glue handy.")
  55. alert("The glue is labeled 'boxer', and you wonder what the glue has to do with boxes.")
  56. document.getElementById("glueCounter").innerHTML= glueResource + " glue";
  57. } else if (glueResource == 0 && nailReveal == 0) {
  58. nailReveal = 1
  59. alert("You dug around in your pack, and found 10 nails. You could use this to make some stools.");
  60. document.getElementById("nailCounter").innerHTML= nailResource + " nails";
  61. } else if (woodResource >= 50 && nailResource >= 2) {
  62. woodResource = woodResource - 50
  63. stoolCount = stoolCount + 1
  64. nailResource = nailResource - 2
  65. document.getElementById("nailCounter").innerHTML= nailResource + " nails";
  66. document.getElementById("stoolCounter").innerHTML= stoolCount + " stools";
  67. } else {
  68. document.getElementById("failText").innerHTML= matsfailtxt
  69. }
  70. document.getElementById("woodCounter").innerHTML= woodResource + " wood";
  71.  
  72. }
  73.  
  74. function noStool() {
  75. if (stoolCount >= 1) {
  76. stoolCount = stoolCount - 1
  77. woodResource = woodResource + 35
  78. } else {
  79. document.getElementById("failText").innerHTML= structuresfailtxt
  80. }
  81. document.getElementById("woodCounter").innerHTML= woodResource + " wood";
  82. document.getElementById("stoolCounter").innerHTML= stoolCount + " stools";
  83. }
  84. </script>
  85.  
  86. </body>
  87. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement