Advertisement
justync7

block

Jun 5th, 2013
105
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.77 KB | None | 0 0
  1.  
  2.  
  3. w, h=term.getSize()
  4. locations={}
  5. for i=1,w do
  6. locations[i]={}
  7. for z=1,h do
  8. locations[i][z]="Air"
  9. end
  10. end
  11. blocks={}
  12. block={}
  13. block.addBlock = function(name,char,backColor,frontColor)
  14. blocks[name]={}
  15. blocks[name].char=char:sub(1,1)
  16. blocks[name].backColor=backColor
  17. blocks[name].frontColor=frontColor
  18. blocks[name].easterEgg="While you are coding ill be STILL ALIVE."
  19. end
  20.  
  21. block.renderBlock = function(name,x,y)
  22. locations[x][y]=name
  23. term.setCursorPos(x,y)
  24. term.setBackgroundColor(blocks[name].backColor)
  25. term.setTextColor(blocks[name].frontColor)
  26. write(blocks[name].char)
  27. end
  28.  
  29. block.getBlock = function(x,y)
  30. return locations[x][y]
  31. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement