Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local dx, dy = 3, 3
- local scr_x, scr_y = term.getSize()
- local range = {1,20}
- local dice = paintutils.loadImage("dice.nfp")
- local tc = term.current().setVisible
- function render(x,y,number)
- tc(false)
- for a = 1, scr_y do
- term.setCursorPos(1,a)
- if a > scr_y/2 then
- term.setBackgroundColor(colors.brown)
- else
- term.setBackgroundColor(colors.yellow)
- end
- term.clearLine()
- end
- paintutils.drawImage(dice,x-dx,y-(dy-1))
- term.setCursorPos(x,y)
- term.setTextColor(colors.black)
- term.setBackgroundColor(colors.lightBlue)
- term.write(tostring(number))
- tc(true)
- end
- --os.queueEvent("key", keys.space)
- render(scr_x/2,-6,"")
- while true do
- local evt, key = os.pullEvent("key")
- if key == keys.space then
- for a = -2, (scr_y/2)+1 do
- render(scr_x/2,a,math.random(range[1],range[2]))
- sleep(0)
- end
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement