Advertisement
BigSHinyToys

15 sprites test no alpha channel

Jan 20th, 2013
110
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 2.43 KB | None | 0 0
  1. local col = {
  2.     ["0"] = 1,
  3.     ["1"] = 2,
  4.     ["2"] = 4,
  5.     ["3"] = 8,
  6.     ["4"] = 16,
  7.     ["5"] = 32,
  8.     ["6"] = 64,
  9.     ["7"] = 125,
  10.     ["8"] = 256,
  11.     ["9"] = 512,
  12.     ["A"] = 1024,
  13.     ["B"] = 2048,
  14.     ["C"] = 4096,
  15.     ["D"] = 8192,
  16.     ["E"] = 16384,
  17.     ["F"] = 32768
  18. }
  19.  
  20. local function drawChar(image,posX,posY)
  21.     for y = 1,#image do
  22.         term.setCursorPos(posX,posY+y-1)
  23.         local st = ""
  24.         local lastF = col[image[y][1].f]
  25.         local lastB = col[image[y][1].b]
  26.         for x = 1,#image[y] do
  27.             if lastF == image[y][x].f and lastB == image[y][x].b then
  28.                 st = st..image[y][x].c
  29.             else
  30.                 term.setTextColor(lastF)
  31.                 term.setBackgroundColor(lastB)
  32.                 term.write(st)
  33.                 st = image[y][x].c
  34.                 lastF = col[image[y][x].f]
  35.                 lastB = col[image[y][x].b]
  36.             end
  37.         end
  38.         term.setTextColor(lastF)
  39.         term.setBackgroundColor(lastB)
  40.         term.write(st)
  41.     end
  42. end
  43.  
  44. local img = {
  45.     {
  46.         {f = "E",b = "A",c = "T"},
  47.         {f = "E",b = "C",c = "E"},
  48.         {f = "E",b = "D",c = "S"},
  49.         {f = "E",b = "0",c = "T"},
  50.         {f = "A",b = "A",c = " "},
  51.     },
  52.     {
  53.         {f = "A",b = "B",c = "F"},
  54.         {f = "A",b = "B",c = "I"},
  55.         {f = "A",b = "B",c = "L"},
  56.         {f = "A",b = "B",c = "E"},
  57.         {f = "A",b = "A",c = " "},
  58.     },
  59.     {
  60.         {f = "A",b = "A",c = " "},
  61.         {f = "A",b = "A",c = " "},
  62.         {f = "A",b = "A",c = " "},
  63.         {f = "A",b = "A",c = " "},
  64.         {f = "A",b = "A",c = " "},
  65.     },
  66.     {
  67.         {f = "A",b = "A",c = " "},
  68.         {f = "A",b = "A",c = " "},
  69.         {f = "A",b = "A",c = " "},
  70.         {f = "A",b = "A",c = " "},
  71.         {f = "A",b = "A",c = " "},
  72.     },
  73.     {
  74.         {f = "A",b = "A",c = " "},
  75.         {f = "A",b = "A",c = " "},
  76.         {f = "A",b = "A",c = " "},
  77.         {f = "A",b = "A",c = " "},
  78.         {f = "A",b = "A",c = " "},
  79.     },
  80. }
  81.  
  82. local offX,offY = 1,1
  83.  
  84. while true do
  85.     term.setBackgroundColor(32768)
  86.     term.clear()
  87.     drawChar(img,offX,offY)
  88.     drawChar(img,offX,offY+6)
  89.     drawChar(img,offX,offY+12)
  90.     drawChar(img,offX+6,offY)
  91.     drawChar(img,offX+6,offY+6)
  92.     drawChar(img,offX+6,offY+12)
  93.     drawChar(img,offX+12,offY)
  94.     drawChar(img,offX+12,offY+6)
  95.     drawChar(img,offX+12,offY+12)
  96.     drawChar(img,offX+18,offY)
  97.     drawChar(img,offX+18,offY+6)
  98.     drawChar(img,offX+18,offY+12)
  99.     drawChar(img,offX+24,offY)
  100.     drawChar(img,offX+24,offY+6)
  101.     drawChar(img,offX+24,offY+12)
  102.     local event = {os.pullEvent("key")}
  103.     if event[2] == 200 then
  104.         offY = offY - 1
  105.     elseif event[2] == 208 then
  106.         offY = offY + 1
  107.     elseif event[2] == 203 then
  108.         offX = offX - 1
  109.     elseif event[2] == 205 then
  110.         offX = offX + 1
  111.     elseif event[2] == 28 then
  112.         return
  113.     end
  114. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement