How to use Line Of Sight behavior with multiple enemies? My enemy sprites have Platform behavior to control their movement.
For the enemy AI I've got something like this:
If Enemy has LOS to Player > Enemy simulate Platform pressing Right, Left, Jump, etc.
It all works fine with a single enemy but as soon as I create two or more enemies I start having this problem:
If Enemy #1 has LOS to player and simulates Platfrom pressing Right or Left then all other enemies do the same even if they don't have direct LOS to the player...
How to solve this problem?
Develop games in your browser. Powerful, performant & highly capable.
add a for each loop, so its like
"for each "enemy""
>enemy has LOS to player > enemy simulate blah.
attach a .capx for more help, that is just my initial thought without much put into it.
Yes, it works now with the For Loop! Thank you! But I'm still having one more problem:
If [Enemy] is [On Stopped] + [Overlapping Player] then play [Attack] sound
It works fine with a single enemy but, again, it doesn't work with multiple enemies. The For Loop isn't working here since there is a Trigger (On Stopped).
Any ideas on how to make each enemy play Attack sound as soon as they are close to the Player?
P.S. - I'm sorry but I can't send the .capx because it's a big project which is about to be released soon and I don't know if my people would like someone to have their project before them, you know.
I am recently having some troubles with LOS too. Shouldn't 'has Line of Sight' pick the object who has LOS without needing to go through a 'for each' loop? Like if you use 'on landed' for platform behaviour, it will only pick the instance that has landed, not all instances of that object.