Want more features on Pastebin? Sign Up, it's FREE!
Guest

Untitled

By: a guest on Nov 6th, 2012  |  syntax: Lua  |  size: 1.76 KB  |  views: 260  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. local randMove = 0
  2. local prevMove = 0
  3. local newMove = 0
  4.  
  5. local rTile = 0
  6. local nTile = 0
  7.  
  8. local move= {1,0,0,0,0,0,0,0,0,0,0,0,0,0,-1}
  9.  
  10. local spacing = 0
  11. local ySpacing = 10
  12.  
  13. local level5 = {1,1,1,1,34,34,1,1,1,1,1,1,1,1,2,1,1,1,1,1,1,1,1,1,1,1,1,1,1,2}
  14. local level5a ={1,1,1,1,34,34,1,1,1,1,1,1,1,1,2,1,1,1,1,1,1,1,1,1,1,1,1,34,34,34}
  15. local rMap ={{},{},{},{},{}}
  16. local a = 1
  17.  
  18. --mon = peripheral.wrap("left")
  19. --local w,h = mon.getSize()
  20. --term.redirect(mon)
  21. term.clear()
  22.  
  23. function dTile(a)
  24.   if nTile==1 then --stone
  25.     paintutils.drawPixel(spacing+1, newMove+ySpacing+a, colors.gray)
  26.   end  
  27.   if nTile==2 then --dirt
  28.     paintutils.drawPixel(spacing+1, newMove+ySpacing+a, colors.brown)
  29.   end
  30.   if nTile==3 then --grass
  31.     paintutils.drawPixel(spacing+1, newMove+ySpacing+a, colors.lime)
  32.   end
  33.   if nTile==34 then --iron
  34.     paintutils.drawPixel(spacing+1, newMove+ySpacing+a, colors.lightGray)
  35.   end
  36. end
  37.  
  38. function createTile()
  39.  --level1
  40.   nTile = 3
  41.   rMap[1][a]=nTile
  42.   dTile(0)
  43.   --level2
  44.   nTile = 2
  45.   rMap[2][a]=nTile
  46.   dTile(1)
  47.   --level3
  48.   nTile = 2
  49.   rMap[3][a]=nTile
  50.   dTile(2)
  51.   --level4
  52.   rTile = math.random(1,30)
  53.   nTile = level5[rTile]
  54.   dTile(3)
  55.   rMap[4][a] = nTile
  56.   --level5
  57.   rTile = math.random(1,30)
  58.   if rMap[5][a-1]==34 or rMap[4][a]==34 then
  59.     nTile = level5a[rTile]
  60.   else
  61.     nTile = level5[rTile]
  62.   end
  63.   dTile(4)
  64.   rMap[5][a]=nTile
  65.  
  66.  
  67. end
  68.  
  69. function gTile()
  70.   if a <= 60 then
  71.     if prevMove==0 then
  72.       randMove = math.random(1,15)
  73.       newMove = move[randMove]
  74.       createTile()
  75.        
  76.     else
  77.       newMove = 0
  78.       createTile()
  79.     end
  80.    
  81.     a = a+1
  82.     spacing = spacing + 1
  83.     ySpacing = ySpacing + newMove
  84.   end
  85. end
  86.  
  87. while true do
  88.   gTile()
  89.   sleep(0)
  90. end
clone this paste RAW Paste Data