Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local monitor = peripheral.wrap("right")
- gameEnd = false
- local xPos
- local yPos
- i=0
- pod1 = {x=1,y=1}
- pod2 = {x=5,y=1}
- pod3 = {x=9,y=1}
- pod4 = {x=13,y=1}
- while gameEnd == false do
- local timeout = os.startTimer(.5)
- monitor.setBackgroundColor(colors.red)
- monitor.setCursorPos(pod1.x,pod1.y)
- monitor.write("O")
- monitor.setCursorPos(pod2.x,pod2.y)
- monitor.write("O")
- monitor.setCursorPos(pod3.x,pod3.y)
- monitor.write("O")
- monitor.setCursorPos(pod4.x,pod4.y)
- monitor.write("O")
- eventx = {os.pullEvent()}
- os.sleep(.5)
- --print(eventx[1]) Name
- --print(eventx[3]) XPos
- --print(eventx[4]) YPos
- if eventx[1] == "monitor_touch" then
- xPos = eventx[3]
- yPos = eventx[4]
- if ( (xPos == pod1.x) and (yPos == pod1.y)) then
- pod1.y = 1
- end
- if ( (xPos == pod2.x) and (yPos == pod2.y)) then
- pod2.y = 1
- end
- if ( (xPos == pod3.x) and (yPos == pod3.y)) then
- pod3.y = 1
- end
- if ( (xPos == pod4.x) and (yPos == pod4.y)) then
- pod4.y = 1
- end
- end
- if eventx[1] == "timer" and eventx[2] == timeout then
- print("going")
- end
- monitor.setBackgroundColor(colors.black)
- monitor.clear()
- pod1.y = pod1.y +1
- pod2.y = pod2.y +1
- pod3.y = pod3.y +1
- pod4.y = pod4.y +1
- if pod1.y > 12 then
- pod1.y = 1
- end
- if pod2.y > 12 then
- pod2.y = 1
- end
- if pod3.y > 12 then
- pod3.y = 1
- end
- if pod4.y > 12 then
- pod4.y = 1
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement