Advertisement
Guest User

map_generate()

a guest
Sep 16th, 2018
337
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.05 KB | None | 0 0
  1.  function map_generate(tilemap, tilemapProperties)
  2.     for i = 1, tilemapProperties.rows do
  3.         tilemap[i] = {}
  4.         for j = 1, tilemapProperties.columns do
  5.             if i == 1 then
  6.                 if j == 1 then
  7.                     tilemap[i][j] = 1
  8.                 elseif j == tilemapProperties.columns then
  9.                     tilemap[i][j] = 3
  10.                 else
  11.                     tilemap[i][j] = 2
  12.                 end
  13.             elseif i == tilemapProperties.rows then
  14.                 if j == 1 then
  15.                     tilemap[i][j] = 7
  16.                 elseif j == tilemapProperties.columns then
  17.                     tilemap[i][j] = 5
  18.                 else
  19.                     tilemap[i][j] = 6
  20.                 end
  21.             else
  22.                 if j == 1 then
  23.                     tilemap[i][j] = 8
  24.                 elseif j == tilemapProperties.columns then
  25.                     tilemap[i][j] = 4
  26.                 else
  27.                     tilemap[i][j] = 0
  28.                 end
  29.             end
  30.         end
  31.     end
  32. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement