magnitude for enemy attack

Hi Everyone,

I am trying figure out the best way to accomplish an actor (not the hero) attack a enemy. Here is what I am trying to accomplish. My Hero has a falcon that follows him around approximately 200-300 pixels away. When the Falcon gets close to an enemy around 200 pixels..he will leave them main character an attack the enemy.

Let me know if anyone has any suggestions.

Thanks

Comments

  • RThurmanRThurman Member, Sous Chef, PRO Posts: 2,879

    Method 1:
    Make the 'enemy' actors have a 200 diameter. (Most of the actor would be transparent space with the smaller 'enemy' graphic is the middle.)

    When the falcon is within the enemy actor's bounds -- attack towards the center of the actor. (Where the 'enemy' graphic is.)

    Method 2:
    Make a separate detection actor that is constrained to the 'enemy' actor. Make it 200x200 with a circle collision.

    When the falcon is within the enemy actor's detection actor -- attack towards the center of the actor. (Where the 'enemy' actor is.)

    Method 3:
    Make the falcon 200x200 (with mostly transparent space).

    When any particular 'enemy' actor is within the bounds of the falcon -- attack.

    Method 4:
    Track all enemy actors distances from the falcon (using the magnitude function). Put them all in a table. Row one corresponds to 'enemy' actor 1, row two = actor 2, and so on.

    When any of the table cell values are less than 200 then target the xy coordinates associated with the table row number.

  • quinn221quinn221 Member Posts: 280

    Thanks! I will give it a try!

    @RThurman said:
    Method 1:
    Make the 'enemy' actors have a 200 diameter. (Most of the actor would be transparent space with the smaller 'enemy' graphic is the middle.)

    When the falcon is within the enemy actor's bounds -- attack towards the center of the actor. (Where the 'enemy' graphic is.)

    Method 2:
    Make a separate detection actor that is constrained to the 'enemy' actor. Make it 200x200 with a circle collision.

    When the falcon is within the enemy actor's detection actor -- attack towards the center of the actor. (Where the 'enemy' actor is.)

    Method 3:
    Make the falcon 200x200 (with mostly transparent space).

    When any particular 'enemy' actor is within the bounds of the falcon -- attack.

    Method 4:
    Track all enemy actors distances from the falcon (using the magnitude function). Put them all in a table. Row one corresponds to 'enemy' actor 1, row two = actor 2, and so on.

    When any of the table cell values are less than 200 then target the xy coordinates associated with the table row number.

Sign In or Register to comment.