Advertisement
ferel

Test2

May 30th, 2016
76
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.54 KB | None | 0 0
  1. component = require("component")
  2. modem = require("component").modem
  3. event = require("event")
  4. event.pull = require("event").pull
  5. gpu = require("component").gpu
  6.  
  7. x = 1
  8. y = 1
  9. modem.open(1)
  10. gpu.setResolution(50,16)
  11. gpu.fill(1,1,50,16," ")
  12. while true do
  13. _,_,_,_,_,a = event.pull(modem_message)
  14. if a == "W" then
  15. y = y - 1
  16. gpu.set(x,y,"#")
  17. else
  18.  if a == "S" then
  19.  y = y + 1
  20.  gpu.set(x,y,"#")
  21.  else
  22.   if a == "A" then
  23.   x = x - 1
  24.   gpu.set(x,y,"#")
  25.   else
  26.    if a == "D" then
  27.    x = x + 1
  28.    gpu.set(x,y,"#")
  29.    end
  30.   end
  31.  end
  32. end
  33. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement