Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- DDRGame
- local rRunning = 1
- a1 = 0
- a2 = 0
- a3 = 0
- a4 = 0
- a5 = 0
- a6 = 0
- b1 = 0
- b2 = 0
- b3 = 0
- b4 = 0
- b5 = 0
- b6 = 0
- c1 = 0
- c2 = 0
- c3 = 0
- c4 = 0
- c5 = 0
- c6 = 0
- d1 = 0
- d2 = 0
- d3 = 0
- d4 = 0
- d5 = 0
- d6 = 0
- aHold = 0
- bHold = 0
- cHold = 0
- dHold = 0
- Score = 0
- Life = 16
- GameOn = 0
- -- a = Green, b = Blue, c = Red, d = Yellow
- while rRunning == 1 do
- if GameOn == 0 then
- print("Debug: Awaiting Redstone Input!")
- local rEvent, param = os.pullEvent()
- if rEvent == "redstone" then
- if redstone.getInput("back") then
- if redstone.getInput("back") == true then
- print("Debug: Input!")
- GameOn = 1
- end
- end
- end
- else
- if colors.test(redstone.getBundledInput("top"), colors.green) == true then aHold = 1
- else aHold = 0 end
- if colors.test(redstone.getBundledInput("top"), colors.blue) == true then bHold = 1
- else bHold = 0 end
- if colors.test(redstone.getBundledInput("top"), colors.red) == true then cHold = 1
- else cHold = 0 end
- if colors.test(redstone.getBundledInput("top"), colors.yellow) == true then dHold = 1
- else dHold = 0 end
- if aHold == 1 and a1 == 1 then
- Score = Score + 1
- elseif aHold == 0 and a1 == 1 then
- Life = Life - 1
- end
- if bHold == 1 and b1 == 1 then
- Score = Score + 1
- elseif bHold == 0 and b1 == 1 then
- Life = Life - 1
- end
- if cHold == 1 and c1 == 1 then
- Score = Score + 1
- elseif cHold == 0 and c1 == 1 then
- Life = Life - 1
- end
- if dHold == 1 and d1 == 1 then
- Score = Score + 1
- elseif dHold == 0 and d1 == 1 then
- Life = Life - 1
- end
- a1 = a2
- a2 = a3
- a3 = a4
- a4 = a5
- a5 = a6
- b1 = b2
- b2 = b3
- b3 = b4
- b4 = b5
- b5 = b6
- c1 = c2
- c2 = c3
- c3 = c4
- c4 = c5
- c5 = c6
- d1 = d2
- d2 = d3
- d3 = d4
- d4 = d5
- d5 = d6
- result1 = math.random(1,4)
- result1 = result1 - ".0"
- if result1 == 1 then
- a6 = 1
- b6 = 0
- c6 = 0
- d6 = 0
- print("Debug: A is going!")
- elseif result1 == 2 then
- b6 = 1
- a6 = 0
- c6 = 0
- d6 = 0
- print("Debug: B is going!")
- elseif result1 == 3 then
- c6 = 1
- a6 = 0
- b6 = 0
- d6 = 0
- print("Debug: C is going!")
- elseif result1 == 4 then
- d6 = 1
- a6 = 0
- b6 = 0
- c6 = 0
- print("Debug: D is going!")
- end
- leftredstone = 0
- rightredstone = 0
- if a1 == 1 then leftredstone = leftredstone + 1 end
- if a2 == 1 then leftredstone = leftredstone + 2 end
- if a3 == 1 then leftredstone = leftredstone + 4 end
- if a4 == 1 then leftredstone = leftredstone + 8 end
- if a5 == 1 then leftredstone = leftredstone + 16 end
- if a6 == 1 then leftredstone = leftredstone + 32 end
- if b1 == 1 then leftredstone = leftredstone + 64 end
- if b2 == 1 then leftredstone = leftredstone + 128 end
- if b3 == 1 then leftredstone = leftredstone + 256 end
- if b4 == 1 then leftredstone = leftredstone + 512 end
- if b5 == 1 then leftredstone = leftredstone + 1024 end
- if b6 == 1 then leftredstone = leftredstone + 2048 end
- if c1 == 1 then rightredstone = rightredstone + 1 end
- if c2 == 1 then rightredstone = rightredstone + 2 end
- if c3 == 1 then rightredstone = rightredstone + 4 end
- if c4 == 1 then rightredstone = rightredstone + 8 end
- if c5 == 1 then rightredstone = rightredstone + 16 end
- if c6 == 1 then rightredstone = rightredstone + 32 end
- if d1 == 1 then rightredstone = rightredstone + 64 end
- if d2 == 1 then rightredstone = rightredstone + 128 end
- if d3 == 1 then rightredstone = rightredstone + 256 end
- if d4 == 1 then rightredstone = rightredstone + 512 end
- if d5 == 1 then rightredstone = rightredstone + 1024 end
- if d6 == 1 then rightredstone = rightredstone + 2048 end
- print("Debug: Life: "..Life)
- print("Debug: Score: "..Score)
- if Life == 0 then
- print("Debug: Game Over!")
- GameOn = 0
- a1 = 0
- a2 = 0
- a3 = 0
- a4 = 0
- a5 = 0
- a6 = 0
- b1 = 0
- b2 = 0
- b3 = 0
- b4 = 0
- b5 = 0
- b6 = 0
- c1 = 0
- c2 = 0
- c3 = 0
- c4 = 0
- c5 = 0
- c6 = 0
- d1 = 0
- d2 = 0
- d3 = 0
- d4 = 0
- d5 = 0
- d6 = 0
- Score = 0
- Life = 16
- rs.setBundledOutput("left",0)
- rs.setBundledOutput("right",0)
- else
- rs.setBundledOutput("left",leftredstone)
- rs.setBundledOutput("right",rightredstone)
- end
- sleep(1.2)
- end
- end
- -- Yay
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement