Why when I destroy one enemy, all enemys are destroyed?

  • Hello I am developing an RPG game, and I decided to insert an variable for my enemy life, i insert that my bullet would subtract 10 from the 30 of enemylife, but when i destroy one enemy, all disapear, wwhat should i do?

    Olá, estou desenvolvendo um jogo RPG e decidi colocar uma variável para a vida do meu inimigo, eu coloquei que a minha bullet tiraria 10 dos 30 pontos de vida do meu inimigo, mas quando eu destruo um inimigo, todos são destruídos, o que eu faço?

    sorry for my bad englishg, im brazilian

  • You should probably put "for each enemy" in there, so it checks for every enemy if the health is less or equal 0.

  • I tried to put at the 2 enemys events but it didnt worked, if you can help me telling where it should be, it would be great! thanks for ur time

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Your 'var_zombie_health' need to be an instance variable not a global. Otherwise it's not possible to see which zombie has a value of 0 health.

  • Oh yes, true.

    Your current health is global and does not work separate for the enemies.

    It is one number in the whole game instead of one number per enemy.

  • Your 'var_zombie_health' need to be an instance variable not a global. Otherwise it's not possible to see which zombie has a value of 0 health.

    Thanks man, I tried to change to instance variable, but at the first moments, I didnt know how to compare the variable to put the minus live and if var_enemy_healthy is minus or equal to zero, it destroy. But after trying to chance some things at the initial events, i could make it right, thanks you again, that problem was really a pain on the ass.

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