The Daily Click ::. Forums ::. Klik Coding Help ::. Advanced Math Object Question
 

Post Reply  Post Oekaki 
 

Posted By Message

Jakob37



Registered
  07/08/2005
Points
  541
3rd September, 2006 at 11:02:42 -

I am using the math object to make enemies move towards you when you are closer than 200 pixels from them, so far no problem.

The problem comes when you have more than one enemy of the same kind, when you comes close to one of them, they all moves towards you.

Does anyone know how to make only the enemies close to you move?

 
n/a

Flava



Registered
  30/07/2002
Points
  684

Has Donated, Thank You!Code MonkeyVIP MemberThe Cake is a LieThe Spinster
3rd September, 2006 at 11:26:35 -

Hm I'm not sure as I'm not used to using the math object, but this might work:

Instead of using the event "Player is 200 pixels away from enemy" - use the event "Enemy is 200 pixels away from player" - I'm not sure whether this would work as I don't know what your events are. Some more information on what exactly your events are might make it easier for us to help you out.

Hope that helps

EDIT: Experimenting now, you might be best to use the advanced direction object. I'll try it out and see if it works

Image Edited by the Author.

 
This is a signature. Have this one on me.

axel

Crazy?

Registered
  05/02/2005
Points
  4766

Game of the Week WinnerYou've Been Circy'd!
3rd September, 2006 at 11:37:58 -

Or use fastlooping and spread a value.

 
n/a

Flava



Registered
  30/07/2002
Points
  684

Has Donated, Thank You!Code MonkeyVIP MemberThe Cake is a LieThe Spinster
3rd September, 2006 at 11:39:48 -

Yeh I've tried lots of things and still get the same problem - so looks like you'll have to do what axel said

 
This is a signature. Have this one on me.

Jakob37



Registered
  07/08/2005
Points
  541
3rd September, 2006 at 11:52:35 -

I will experiment s bit with the spread-value thing. Thanks for the help both of you

 
n/a

Werbad



Registered
  18/09/2002
Points
  235
3rd September, 2006 at 11:57:36 -

Set a value on the enemies to the distance to the player and then check if the value is less than 200px

example:

* Always
- "Enemy" Set Value A to Dist("Advanced Math object", X("Player") - X("Enemy"), Y("Player") - Y("Enemy") )

* Value A of "Enemy" is <= 200
- Move enemy

 
n/a

Jakob37



Registered
  07/08/2005
Points
  541
3rd September, 2006 at 12:16:22 -

That works exactly as I wanted, thank you very much

 
n/a
   

Post Reply



 



Advertisement

Worth A Click