Advertisement
alestane

Map creation (single loop)

Jan 2nd, 2014
170
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1.     for i=1, 8 do
  2.         for j=1, 8 do
  3.             if gameMap[i][j] == 1 then
  4.                 gameMap[i][j] = gameTile(i,j)
  5.                 group:insert(gameMap[i][j])
  6.             elseif gameMap[i][j] == 0 then
  7.                 gameMap[i][j] = brickTile(i,j)
  8.                 group:insert(gameMap[i][j])
  9.             elseif gameMap[i][j] == 2 then
  10.                 gameMap[i][j] = grassTile(i,j)
  11.                 group:insert(gameMap[i][j])
  12.             elseif gameMap[i][j] == 3 then
  13.                 gameMap[i][j] = tileWithBox(i,j)
  14.                 group:insert(gameMap[i][j])
  15.             elseif gameMap[i][j] == 4 then
  16.                 gameMap[i][j] = heroTile(i,j)
  17.                 group:insert(gameMap[i][j])
  18.             end
  19.         end
  20.     end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement