Advertisement
LazerAio

ReactGame.lua

Jul 5th, 2022
131
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.45 KB | None | 0 0
  1. term.clear()
  2. print("WELCOME TO REACT")
  3. print("A game made by Aio in 2022")
  4. print("")
  5. print("Press enter to begin!")
  6. print("")
  7. print("The objective is to press any key only when the blue color is shown")
  8. print("")
  9. print("CAUTION, FAST FLASHING LIGHTS!!")
  10. read()
  11. term.clear()
  12. score = 0.8
  13. HP = 1.5
  14. function bar(p)
  15. term.setCursorPos(1,1)
  16. print(string.rep("_",3))
  17. term.setCursorPos(1,1)
  18. print(string.rep("#",(p*5)-2))
  19. end
  20. while true do
  21. if HP > 50 then
  22. print("Game over!")
  23. print("I suspect that you have been cheating")
  24. print("This should be humanly impossible!!")
  25. break
  26. end
  27. HP = HP - 0.5
  28. term.setBackgroundColor(colors.black)
  29. term.clear()
  30. if HP == 0.5 then
  31. term.setTextColor(colors.lime)
  32. textutils.slowPrint("Game over!")
  33. print("You got a score of",score)
  34. sleep(1)
  35. break
  36. end
  37. score = score + 0.2
  38. print("HP",HP)
  39. print("SCORE",score)
  40. print("DELAY",(5/score))
  41. DELAY = 5/score
  42. print(DELAY/10)
  43. for y=0,5 do
  44. bar((10-y)/10)
  45. sleep(DELAY/(10-y))
  46. end
  47. if math.random(0,100) > 75 then
  48. term.setBackgroundColor(colors.red)
  49. R = false
  50. else
  51. term.setBackgroundColor(colors.blue)
  52. R = true
  53. end
  54. term.clear()
  55. os.startTimer(5/score)
  56. E = os.pullEvent()
  57. os.cancelTimer(5/score)
  58. if E == "key" then
  59. if R == false then
  60. score = score - 1
  61. else
  62. HP = HP + 1
  63. end
  64. else
  65. if R == true then
  66. score = score - 0.5
  67. else
  68. HP = HP + 0.5
  69. end
  70. end
  71. end
  72.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement