Advertisement
BigSHinyToys

basic Image draw

Feb 19th, 2013
199
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.60 KB | None | 0 0
  1. npc = {
  2. " -------- ",
  3. "|        |",
  4. "|        |",
  5. " --------",
  6. "Merchant"}
  7.  
  8. local function picture(image,positionX,positionY)
  9.     for y = 1,#image do
  10.         term.setCursorPos(positionX,positionY + y - 1)
  11.         term.write(image[y])
  12.     end
  13. end
  14.  
  15. local posX,posY = 1,1
  16. while true do
  17.    
  18.     term.clear()
  19.     picture(npc,posX,posY)
  20.    
  21.     local event = {os.pullEvent()}
  22.    
  23.     if event[1] == "key" then
  24.         if event[2] == 200 then
  25.             posY = posY - 1
  26.         elseif event[2] == 208 then
  27.             posY = posY + 1
  28.         elseif event[2] == 203 then
  29.             posX = posX - 1
  30.         elseif event[2] == 205 then
  31.             posX = posX + 1
  32.         end
  33.     end
  34.    
  35. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement