daily pastebin goal
36%
SHARE
TWEET

Untitled

a guest Mar 18th, 2019 42 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. inspect = require("inspect")
  2.  
  3.  
  4. function love.load()
  5.   gameTable = {}
  6.   gameTable[0] = {}
  7.  
  8.  
  9.  
  10.   table.insert(gameTable[0], {value=2, posX = 0, posY = 0})
  11.   table.insert(gameTable[0], {value=4, posX = 100, posY = 100})
  12.   table.insert(gameTable[0], {value=8, posX = 200, posY = 200})
  13.  
  14.  
  15.  
  16.  -- gameTable[0][0] = {value=2, posX = 0, posY = 0}
  17.  -- gameTable[0][1] = {value=4, posX = 100, posY = 100}
  18.  -- gameTable[0][2] = {value=8, posX = 200, posY = 200}
  19.  
  20.  
  21. --  block2 = love.graphics.newQuad(0, 0, 107, 107, allBlocks:getDimensions()) --2
  22. --  block4 = love.graphics.newQuad(141, 0, 107, 107, allBlocks:getDimensions()) -- 4
  23. --  block8 = love.graphics.newQuad(278, 0, 107, 107, allBlocks:getDimensions()) -- 4
  24.  
  25.  
  26.    sourceBlocks = love.graphics.newImage('images/blocks.png')
  27.  
  28.  blocks = {}
  29.  table.insert(blocks, love.graphics.newQuad(0, 0, 107, 107, sourceBlocks:getDimensions()))
  30.  table.insert(blocks, love.graphics.newQuad(141, 0, 107, 107, sourceBlocks:getDimensions()))
  31.  table.insert(blocks, love.graphics.newQuad(278, 0, 107, 107, sourceBlocks:getDimensions()))
  32.  table.insert(blocks, love.graphics.newQuad(415, 0, 107, 107, sourceBlocks:getDimensions()))
  33.  
  34.   posX = 0
  35.   posY = 0
  36.  
  37.  
  38.  
  39. end
  40.  
  41. function love.draw()
  42.  
  43.   for index, quad in pairs(blocks) do
  44.    
  45.    
  46.     love.graphics.draw(sourceBlocks, quad, posX, posY)
  47.  
  48.    
  49.     posX = posX + 127
  50.  
  51.     if (posX >= 635) then
  52.       posX = 0
  53.       posY = 0
  54.     else
  55.       posY = 137
  56.     end
  57.    
  58.    
  59.   end
  60.  
  61.  
  62. end
  63.  
  64. function love.update(dt)
  65. end
  66.  
  67. function drawBlock(cell)
  68.   love.graphics.rectangle("fill", cell.posX, cell.posY, 100, 100)
  69. end
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top