Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local x, y = 1, 1
- local xSize, ySize = term.getSize()
- while true do
- -- Draw a white space at the current x/y co-ord:
- term.setBackgroundColor(colours.black)
- term.clear()
- term.setCursorPos(x, y)
- term.setBackgroundColor(colours.white)
- term.write(" ")
- -- Wait for a key event:
- local event, key = os.pullEvent("key")
- -- Act on it:
- if key == keys.up and y > 1 then
- y = y - 1
- elseif key == keys.down and y < ySize then
- y = y + 1
- elseif key == keys.left and x > 1 then
- x = x - 1
- elseif key == keys.right and x < xSize then
- x = x + 1
- elseif key == keys.q then
- break
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement