Advertisement
dalvorsn

Untitled

Apr 26th, 2012
45
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.86 KB | None | 0 0
  1. function Xadrez:createPieces()
  2.     local piecepos = {}
  3.     pieces = {"tower", "horse", "bishop", "queen", "king","bishop","horse","tower"}
  4.     for _, index in pairs({0,1,6,7}) do piecepos[index] = {} end
  5.     for index, piece in pairs(pieces) do
  6.         piecepos[0][index-1] = "white "..piece
  7.         piecepos[7][index-1] = "black "..piece
  8.     end
  9.     for i = 0, 7 do
  10.         piecepos[1][i] = "white pawn"
  11.         piecepos[6][i] = "black pawn"
  12.     end
  13.  
  14.     for x = 0, 7 do
  15.         for y = 0, 7 do
  16.             local pos = {x = INITIAL_POS.x, y = INITIAL_POS.y, z = INITIAL_POS.z}
  17.             pos.x, pos.y = (pos.x + x), (pos.y + y)
  18.             print(tostring(x) .." > ".. tostring(y))
  19.             local creature = getTopCreature(pos)
  20.             if(isCreature(creature.uid) and not isPlayer(creature.uid))then
  21.                 doRemoveCreature(creature.uid)
  22.             end
  23.             if(piecepos[y] and piecepos[y][x]) then
  24.                 doCreateMonster(piecepos[y][x], pos)
  25.             end
  26.         end
  27.     end
  28. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement