How to make Projectiles follow

How to when i hit “A” it will follow a random enemy after 30 seconds or so it will stay at that direction and if another projectile follows the enemy but that enemy is destroyed how to make it follow another enemy

Alright, let me make sure I have the question right:

  1. When you press A, fire a projectile
  2. The projectile should follow a random enemy
  3. If the enemy that the projectile is following is destroyed, start following a different enemy
  4. After 30 seconds of following enemies, the projectile should stop following and fly off into the abyss

Is that right?

1 Like

let me add one more question how can I make it only got only 4 ways (North East West South) and how can I change the direction speed in each way?

yes lol im sorry English is not my Native Language

@Opisticks np! I just wanted to make sure I had all the requirements. Here is some example code for you, I added comments that explain everything:

Thank you

1 Like

I’m so sorry. But how can you make it follow the closest enemy I see it only follows 1 enemy

2 Likes

You could compare the absolute x and y values of the enemies centered around the projectile

1 Like