Advertisement
Phlimy

Untitled

May 16th, 2016
85
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.58 KB | None | 0 0
  1. function openNetwork(channel)
  2. local modem = peripheral.wrap("back")
  3. modem.open(channel)
  4. print("opened modem")
  5. return modem
  6. end
  7.  
  8. function main()
  9. print("running main...")
  10. while true do
  11. sleep(0)
  12. paintutils.drawPixel(x,y,colors.white)
  13. end
  14. return
  15. end
  16.  
  17. function onKey()
  18. while true do
  19. print("waiting for keypress...")
  20. local event, key = os.pullEvent("key")
  21. print("detected keypress")
  22. if key == keys.z then
  23. y = y-1
  24. end
  25. end
  26. return
  27. end
  28.  
  29. term.clear()
  30. modem = openNetwork(42)
  31. x = 5
  32. y = 5
  33. print("launching processes")
  34. parallel.waitForAll(main,onKey)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement