problem with enemy health!

  • Hi,

    i work on defense game and game have many enemies.

    i put enemies in enemy family with health instance , then set for soldier 20 , car 50, tank 100 health.

    i have mine on game for destroy enemies so when enemies On collision with mine:

    enemies(Family) => set health to 0 ( or -1).

    i have : enemies(Family) <= 0 =======> enemies Destroy.

    but my enemies on collision with mine, their health set with 0 , but do not destroy !

    where is the problem?

    (sorry for my bad english)

  • Hi,

    Sounds like you've done everything right. Can you verify that the explosion sets their health to "0" in the debugging mode?

    Family.Health <= 0

    ____ Destroy

    That should be enough to identify which unit's health has become <= and remove it. Can you attach your project?

  • sorry i can't attach my project.

    but i try for

    Family.Health <= 0

    ____ Destroy

    and do not work.

    but when i subtract 20 form health, soldier die on first collision and car in 3th collision and tank on 5th , it means it works very good.

    but for reason i want set it to zero ! or -1 ! witch not work.

    Edit:

    With Family.Health <= 0

    ____ Destroy

    some times work good and some time, when enemies collision with mine, in debug view , it health set to my value, but do not destroy , then when another enemies collision , that enemies with 0 health, destroy !!!!

  • Not sure what you mean but maybe this:

    Put your check for Family.Health OUTSIDE of collision checks. You want it to run all the time, not just when your objects collide.

  • Do you use a system > Compare two values maybe ?

    You have to use a pick condition to pick those ...

    System > conditions > Pick by comparison > Object = the family / Expression = Family.Health / <= / value = 0

    Action > Family > destroy

    I hope you made that variable on the familie.

  • Lncredible thank you for your help.

    99Instances2Go thank you very much, your way very good. why my way has problem?

  • There is no problem in your way. It just selects no objects. The action > destroy needs selected objects to do its magic on.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • hi again,

    i found bug on my game and action,

    when 3 enemies health set 0 on one time for example, nothing happend and enemies with 0 health or negative health , are alive !

    i try my code in Every tick, but the problem not solved.

  • Need to see your code.

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