Log In  

Just need some solutions.

P#148143 2024-05-08 19:52

1

To get a map's tile data use mget() but the map itself doesn't have a screen position. That is sent as an argument when using the map() command.

map(tile_x,tile_y,screen_x,screen_y,tile_width,tile_height)
 -- tile_x: map tile x
 -- tile_y: map tile y
 -- screen_x: x pos on screen
 -- screen_y: y pos on screen
 -- tile_width: map tiles horizontal to draw
 -- tile_height: map tiles vertical to draw

If instead you're trying to figure out how to get a particular tile in a map, you'd have to instead search the map for it.

function map_find(x)
 for i=1,128 do
  for j=1,64 do
   if mget(i,j)==x then
    return i,j
   end
  end
 end
 return -1,-1 -- nothing found
end
P#148146 2024-05-08 20:20 ( Edited 2024-05-08 20:22)

[Please log in to post a comment]