Impact

This forum is read only and just serves as an archive. If you have any questions, please post them on github.com/phoboslab/impact

8 years ago by Nathre

Hello again friends. I don't know if there's a simple way to do this but it's about health. I set the player and entities's health 20 each one but I can only deal 10 every time I hit them or when they hit me. Is there a property to do it this way? Every time I hit an enemy, i get full damage (if it's 100 health, everything goes in one second).

8 years ago by Nathre

There's nothing useful in the docs :(

8 years ago by MikeL

Could you explain a little more? What are your entities and what is colliding with what? For example is it a bullet colliding with a plane? Or a sword colliding with the player?

If you have the loss of health tied together with a collision, then every frame in which there is a collision, there will be loss of health. In the case of a bullet you can remove it (kill it) after a collision. For something like a sword, you would need to toggle a boolean variable, or something along that line, to prevent continued loss of health until the sword is removed and ready to cause damage again.

8 years ago by Nathre

Yes, something like the sword one. It sets bombs but I want it to deal just 10 damage (per bomb), not damage/frame so i can make entities that need 20 damage or more to make the toon place 3 bombs or so.

Ty Mike!

8 years ago by MikeL

The thing to do would be to make the bomb 1) cause damage, then 2) immediately have the bomb call kill on itself. This will effectively remove the bomb entity so that it cannot cause any additional damage.

If the bomb has to go through a sort of explosion animation phase and cannot be killed immediately after causing damage, then set a boolean variable (say this.canCauseDamage = true) in init. Then only allow damage to be caused if the boolean is true, otherwise no damage. Additionally you need to make sure that after the damage is caused, this variable is immediately set to false.
Page 1 of 1
« first « previous next › last »