Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local component = require("component")
- local event = require("event")
- local width = 60
- local height = 30
- local gpu = component.gpu
- local screen = component.screen
- local term = require("term")
- local black = 0x000000
- local red = 0xFF0000
- local green = 0x00FF00
- local grey = 0x222222
- local white = 0xFFFFFF
- local creepers = false
- local explosions = false
- function initializeRedstone()
- --ask other computers for initial redstone values
- end
- function initializeScreen()
- term.clear()
- term.setCursorBlink(false)
- gpu.setResolution(width, height)
- gpu.setBackground(black)
- gpu.setForeground(black)
- gpu.fill(1, 1, width, height, " ")
- gpu.setForeground(white)
- screen.setTouchModeInverted(true)
- end
- function drawCreeper(enabled)
- if enabled then
- gpu.setBackground(green)
- else
- gpu.setBackground(grey)
- end
- gpu.fill(width/2+1,height/4+1,width/2,height/2," ")
- gpu.setBackground(black)
- gpu.fill(width/2+width/12,height/4+4,width/8,height/8," ")
- gpu.fill(width-width/12*2,height/4+4,width/8,height/8," ")
- gpu.fill(width/4+width/2-width/32,height/2,width/8,height/6," ")
- gpu.fill(width-width/6,height/2+height/12,width/8,height/6," ")
- gpu.fill(width-width/4-width/8,height/2+height/12,width/8,height/6," ")
- end
- function drawTNT(enabled)
- if enabled then
- gpu.setBackground(red)
- else
- gpu.setBackground(grey)
- end
- gpu.fill(1,height/4+1,width/2,height/2," ")
- gpu.setBackground(white)
- gpu.fill(1,height/2-height/32,width/2,height/8," ")
- gpu.setBackground(black)
- end
- function drawButtons()
- drawCreeper(creepers)
- drawTNT(explosions)
- end
- function handleTouch(_,screen,x,y,buttonId,playerName)
- if x <= width/2 and y >= height/4 and y <= height-height/4 then
- explosions = not explosions
- elseif x > width/2 and y >= height/4 and y <= height-height/4 then
- creepers = not creepers
- end
- drawButtons()
- end
- initializeRedstone()
- initializeScreen()
- drawButtons()
- event.listen("touch", handleTouch)
Advertisement
Add Comment
Please, Sign In to add comment