My game is similar to KiwiStory, where I'm creating multiple platform levels in a single layout (pic below). In my game, the enemies move towards the player based on Line of Sight behavior (LOS). They start with a smaller LOS range, but once they "see" the player or are hit their range is increased to the Layout width, so they always have LOS to the player on that level.
The player can move to different levels in the layout, similar to how the doors work in KiwiStory. The problem is, once the player moves to another level, the enemies on the original level may still have LOS to the player, so they try to move towards the player. I want to keep them from 'seeing' the player unless they're on the same level.
I see a few ways of implementing this. E.g., a global currentLevel variable that's set when entering the doors, and only enemies with that value can see the player. Or I can compare an enemy's Y coordinate to the Player's Y to determine if they're on the same level. Or I can wrap each level in "obstacle" sprites which can block LOS. Each has its pros and cons, so I wanted to see if there are any strong recommendations for one, or if there's an even better one I'm not thinking of?
Thanks