Pick nearest not working as expected.(SOLVED)

0 favourites
  • 6 posts
From the Asset Store
2D fighting template based in the game that defined the fighting games genre.
  • In my game I have proximity mines that work 'should' work by:

    Distance(mine and enemy) less than or equal to 150 pixels.

    Mine pick nearest enemy.

    Mine is not playing animation "active".

    Then:

    Mine set animation active (from beginning).

    However this doesn't work when multiple mines are on-screen.

    The gun fires a volley of four mines, each with bullet behaviors. Currently the mines have an overlapping sprite pin to them with a larger collision polygon, when they hit the enemy it activates the mine. However because of reasons this method doesnt work well and is limited to one volley at a time. If anyone knows another way that is simple and works independent of the number of mines please let me know.

  • Do you try system condition "For each" ?

  • I tried that but what happens is when the first mine is activated the other mines only activate when they are within the radius of the enemy that set off the first mine. I.e. it only picks the nearest enemy to the first mine, does anyone know how to work around this?

  • Try line of sight.

  • currypuff :

    Don't compare... use picking conditions for picking...

    Don't use this:

    Distance(mine and enemy) less than or equal to 150 pixels.

    Use this:

    Pick (by comparison) : Enemy.X > Mine.X &

    Pick (by comparison) : Enemy.X < or = Mine.X + 150

    And also, use For Each

    Complete event:

    For Each (Enemy)

    Pick (by comparison) : Enemy.X > Mine.X &

    Pick (by comparison) : Enemy.X < or = Mine.X + 150

    Mine pick nearest enemy.

    Mine is not playing animation "active".

    Then:

    Mine set animation active (from beginning).

    However this doesn't work when multiple mines are on-screen.

    Or if it's too complicated for you, then use "Line of Sight"

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Thanks chadorireborn for the suggestion but it didn't give the result I wanted, however line of sight did. Thanks a lot newt, I'm surprised I didn't think of it earlier.

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)