Santhenar's Recent Forum Activity

  • Hi, I could really use some help with this one.

    Okay so I have a player spaceship which shoots missiles. The missiles chase the nearest enemy and collide and explode, killing them. This all works fine.

    The problem occurs when I want to use multiple missiles. What I want is for the first missile fired to lock on to the closest enemy, and the second missile to lock onto the next nearest enemy, and so on.

    I've given each enemy a variable which shows whether or not they are currently targeted by a missile, but all this means is that while one missile is tracking a target all subsequent missiles refuse to track anything as they all access the nearest enemy instance and find out that it is currently being targeted. I need them to check the next nearest instance, and so on.

    I hope that makes sense.

    As far as I can think, the only way to do this would be with a complicated array storing the distances of all the enemies from the player. However I really don't want to do this for two reasons:

    1. There will be a lot of enemies.

    2. I don't know much about using arrays in C2.

    If anyone could help me with a good method of doing this, or point me in the right direction to start with Arrays, that would be awesome!

    Thanks!

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
Santhenar's avatar

Santhenar

Member since 24 May, 2013

None one is following Santhenar yet!

Trophy Case

  • 11-Year Club
  • Email Verified

Progress

12/44
How to earn trophies