The Daily Click ::. Forums ::. Klik Coding Help ::. Help with Object Selection and Spreading
 

Post Reply  Post Oekaki 
 

Posted By Message

Golds



Registered
  01/05/2007
Points
  107
20th August, 2007 at 23:08:55 -

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?

 
n/a

Fifth

Quadruped

Registered
  07/05/2003
Points
  5815

VIP MemberGOTW JULY 2010 WINNER!Kliktober Special Award TagGOTW HALLOWEEN 2011 WINNERPicture Me This Round 51 Winner!
20th August, 2007 at 23:58:16 -

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.

 
Go Moon!

viva/volt

Awesome Sauce

Registered
  26/08/2006
Points
  1694

Game of the Week WinnerSilverNova MemberKlikCast StarVIP Member
21st August, 2007 at 02:16:59 -

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 ).

 
Image
http://bfollington.tumblr.com
   

Post Reply



 



Advertisement

Worth A Click