I'm using this handy script in a conditional branch to check if events are overlapping:
$game_map.events[3].x == $game_map.events[8].x and $game_map.events[3].y == $game_map.events[8].y
But now I need to check if an event is directly adjacent to another (just up, down, left and right, not diagonal). I'd like to avoid using a full script, if possible. Any ideas?
Thanks for reading!
Checking if an event is adjacent to another?
● ARCHIVED · READ-ONLY
-
-
($game_map.events[3].x - $game_map.events[8].x).abs + ($game_map.events[3].y - $game_map.events[8].y).abs == 1Will tell you if another event is exactly 1 tile away. If they were on the same tile, the sum would be 0. If they were corner-to-corner, the sum would be 2.
That does not take the facing direction of either event into account. They could be standing beside each other, facing the same direction, or facing each other, or back-to-back.
If that's an issue, say so, and I'll give you a modified version that takes that into account too. -
This is perfect for my needs, thank you so much! :D
-
This thread is being closed, due to being solved. If for some reason you would like this thread re-opened, please report this post and leave a message why. Thank you.