Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local state = false
- term.setBackgroundColor(colors.red)
- term.clear()
- rs.setOutput("back", true)
- function main()
- while true do
- if state then
- term.setBackgroundColor(colors.green)
- term.clear()
- rs.setOutput("back", false)
- turtle.attack()
- elseif not state then
- term.setBackgroundColor(colors.red)
- term.clear()
- rs.setOutput("back", true)
- end
- os.sleep(.1)
- end
- end
- function swap()
- repeat
- local ev, b, x, y = os.pullEvent("mouse_click")
- until b
- state = not state
- return
- end
- while true do
- parallel.waitForAny(main, swap)
- os.sleep(.1)
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement