Guest User

walktest

a guest
May 2nd, 2016
164
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.70 KB | None | 0 0
  1. local term = require("term")
  2. local event = require("event")
  3. local comp = require("component")
  4. local gpu = comp.gpu
  5.  
  6. local char_space = string.byte(" ")
  7. local running = true
  8.  
  9. function unkownEvent()
  10. end
  11.  
  12. local myEventHandlers = setmetatable({}, { __index = function() return unkownEvent end})
  13.  
  14. function myEventHandlers.walk(screenAddress, x, y, player)
  15.   print(x, y)
  16.   print(player)
  17.   trail(screenAddress, x, y, player)
  18. end
  19.  
  20. function trail(screenAddress, x, y, player)
  21.  
  22.   gpu.bind(screenAddress)
  23.   local w, h = gpu.maxResolution()
  24.   gpu.fill(0, 0, w, h, "▐")
  25. end
  26.  
  27. function handleEvent(eventID, ...)
  28.   if (eventID) then
  29.     myEventHandlers[eventID](...)
  30.   end
  31. end
  32.  
  33. while running do
  34.   handleEvent(event.pull())  
  35. end
Advertisement
Add Comment
Please, Sign In to add comment