Advertisement
SkyWeapons

Button

Apr 6th, 2020
144
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.47 KB | None | 0 0
  1. screen = peripheral.wrap("top")
  2. mod = peripheral.wrap("bottom")
  3.  
  4. xM, yM = screen.getSize()
  5. print("Screen size:"..xM,yM)
  6.  
  7. mod.open(2)
  8.  
  9. function show(color)
  10.     screen.clear()
  11.     screen.setBackgroundColor(color)
  12.     screen.setCursorPos(3,6)
  13.     screen.write("Kill")
  14.    
  15. end
  16.  
  17. while true do
  18.     show(colors.green)
  19.     ev, side, x, y = os.pullEvent("monitor_touch")
  20.     if  1 < x and x < xM and 1 < y and y < yM then
  21.         show(colors.red)
  22.         mod.transmit(2,2, "top")
  23.         sleep(0.25)
  24.     end
  25. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement