How do i find out is two sprites are on the same tile-map column or row?

I need to tell an enemy that it’s lined up with the player on the tile map. How do I do that.

You could check if the player’s x and y poisiton is the same as the enemies.

but i need the col and row
not x and y

Hmm, I could have a solution. Do you have the camera moving around or staying still?


Thats easy.
In the tile toolbox, there are these two blocks:
Set “location” to be the tile map location of one sprite, and “location2” to be the tile map location of another.
Then your if statement will be:
if ((location) [column]) = ((location2) [column]):

1 Like

Woah thanks my solution was a lot harder than that one- I’ve never understood those blocks before!

Oh, that makes sense. I was trying to use those blocks but they never worked.