Advertisement
Guest User

Untitled

a guest
Mar 26th, 2019
90
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.80 KB | None | 0 0
  1. --[[
  2.   if pY-zoom < 1       then pY = zoom+1 end
  3.   if pY+zoom > #map    then pY = #map-zoom end
  4.   if pX+zoom > #map[1] then pX = #map[1]-zoom end
  5.   if pX-zoom < 1       then pX = zoom+1 end
  6.  
  7.   for y=pY - zoom, pY + zoom, 1 do
  8.     for x=pX - zoom, pX + zoom, 1 do
  9.       if x > 0 and x < #map[1]+1 and y > 0 and y <#map+1 then
  10.         if map[y][x] ~= 0 then
  11.           local cell = map[y][x]
  12.           local cTile = tiles[cell]
  13.           local originX = (x-(pX)+zoom)*(width/(2*zoom+1))
  14.           local originY = (y-pY+zoom)*(height/(2*zoom+1))
  15.           local tileSizeX = (width/((2*zoom)+1))/ cTile:getWidth()
  16.           local tileSizeY = height/((2*zoom)+1)/ cTile:getHeight()
  17.           love.graphics.draw(cTile, originX,originY,0,tileSizeX , tileSizeY)
  18.         end
  19.       end
  20.     end
  21.   end
  22.  
  23.   --]]
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement