How do I get my enemies to change target after destroyed

0 favourites
  • 5 posts
From the Asset Store
Pixel Enemies for SHMUP consists of 38 enemy ship sprites to be used in your game.
  • Greetings all.

    I am working on getting my zombies to attack multiple turrets. Once a turret is destroyed, I want them to attack another turret that is still active.

    Currently, with the pathing behavior, they will choose different turrets, which is fine at the begining. But once the current target they have selected is destroyed, they don't move on to the other target. Additionally, the ones that were attacking the other active turret, stop attacking it.

    I have the following line in my events:

    Turret [On Destroyed] > Zombie [Find path to Turret.X,Turret.Y]

    Currently, I have added an "On Touch" option to re-acquire the turret using the exact same code (without the "on destroyed") and that part works fine. I click the button and they go for the turret that is still alive.

    Attached is my example file (please excuse the horrible graphics... still working on concept)

    I appreciate any help to clear this up. Im sure its something simple, but I have been screwing with this simple bug longer than I should have.


  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Xarddrax I am not a computer to be able to open the CAPX but without looking at it I would add a line of sight event. That could be a simple fix.

    If zombie has line of sight to turret then zombie will find path to turret

  • Would this work?

  • Xarddrax fixed the shooting too so they only shoot when zombies are in line of sight.

  • Brilliant! Thanks and robertjs3! Exactly what I was trying to do.

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