Advertisement
alestane

Sokoban Movement (adjust box)

Jan 2nd, 2014
192
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. local function move(map, startX, startY, dX, dY)
  2.     local targetX, targetY = startX + dX, startY + dY
  3.     if not map[targetX][targetY] then return startX, startY; end
  4.     if map[targetX][targetY].isBox then
  5.         local slideX, slideY = targetX + dX, targetY + dY
  6.         if not (map[slideX] and map[slideX][slideY] and map[slideX][slideY].isWalkable) then return startX, startY; end
  7.         tileBlox[gameMap[targetX][targetY].id].x = gameMap[slideX][slideY].x
  8.     end
  9. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement