I'm surpremely frustrated trying to get my simple enemy behaviors working.
I have an enemy that walks towards the player and shoots at him, and avoids stepping off the edge of platforms. All well and good.
And for multiple incarnations, I do a Spread Value, and a fast loop to handle each instances events. But if I added more than say 3 or 4, spread out through a big scrolling frame, the first enemies I see will behave properly, but when i come to another one later on in the frame, big chunks of his events just won't execute. He won't move to you or shoot.
I think the crux is I have it set to only walk/fire at you if you're close to it Abs(Player(x)-Enemy(x) + Player - Enemy) < 250 or somesuch. I can't seem to get this to work, and it's really frustrating.
I've even tried using the Object Selection Extension to spread 1 on Enemies that meet that criteria and fast loop for that, but it's also buggy.
Can anyone give me some tips on how to have multiple instances of an active object only perform events when close to the player?
The first thing that comes to mind is that you don't want to spread the value and start the fastloop on the same event. Even if they're ordered properly, it doesn't turn out right.
Make two duplicate events, spread the value in the first, start the loop in the second.
Also make sure that your instance-testing condition comes right after the loop definition. Like...
On loop "coll-test"
+ Alterable Value A of Active = LoopIndex("coll-test")
+ Other conditions, if need be
Hmm... And I'm not quite sure how you're doing it, but you might not even need to loop...?
If you're only worrying about the enemy acting if you're close enough, you can go ahead and set one of the enemies' alterable values to its distance to the player, and then test that value.
...And that's all the general advice I've got on the subject.
Object selection using the distance formula doesn't work. You need to (this is a guess) set an alt value to their distance always and say select object by alt value (under create objects icon ).