Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local component = require("component")
- local gpu = component.gpu
- local w, h = gpu.getResolution()
- local mon = require("tty")
- local event = require("event")
- mon.clear()
- gpu.setBackground(0x000000)
- gpu.fill(1, 1, w, h, " ")
- gpu.setBackground(0xFF0000)
- gpu.fill(30, 15, 100, 25, " ")
- while true do
- local _,_,x,y = event.pull("touch")
- if x>30 and x<130 and y>15 and y<40 then
- local color = math.random(0x000000,0xFFFFFF)
- gpu.setBackground(color)
- gpu.fill(1, 1, w, h, " ")
- gpu.setBackground(0x00FF00)
- gpu.fill(30, 15, 100, 25, " ")
- os.sleep(3.0)
- gpu.setBackground(0x000000)
- gpu.fill(1, 1, w, h, " ")
- gpu.setBackground(0xFF0000)
- gpu.fill(30, 15, 100, 25, " ")
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment