# The player damage taking very quickly

**URL:** <https://forum.defold.com/t/the-player-damage-taking-very-quickly/82419>\
**Category:** Questions\
**Created:** [February 22, 2026, 8:44pm UTC](https://forum.defold.com/t/the-player-damage-taking-very-quickly/82419 "2026-02-22T20:44:50Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![franciscorenef](https://forum-defold.b-cdn.net/user_avatar/forum.defold.com/franciscorenef/32/42365_2.png) [@franciscorenef](https://forum.defold.com/u/franciscorenef)\
**Post date:** [February 22, 2026, 8:44pm UTC](https://forum.defold.com/t/the-player-damage-taking-very-quickly/82419/1 "2026-02-22T20:44:50Z")

</div>

The player’s health decreases very, very quickly due to collision detection; the system invokes the damage-taking function very rapidly. The question is, how can I control the player’s health so that it decreases gradually?

[![](https://img.youtube.com/vi/ZVmWdV0ujtA/maxresdefault.jpg "2026 02 22 17 37 36") ](https://www.youtube.com/watch?v=ZVmWdV0ujtA)

---

<div class="post-metadata">

**Author:** ![Mathias](https://forum-defold.b-cdn.net/user_avatar/forum.defold.com/mathias/32/44015_2.png) [@Mathias](https://forum.defold.com/u/Mathias)\
**Post date:** [February 22, 2026, 9:15pm UTC](https://forum.defold.com/t/the-player-damage-taking-very-quickly/82419/2 "2026-02-22T21:15:12Z")

</div>

Because you respond to collision message, there will be many message while the bullet go through the player.  
You can have a “hit timer” (state) you start when hit, and decrease to zero for some time, then you can be hit again.  
Then you adjust the time to your gameplay.

Another way is to store the id of the bullet in a table ( bullets[id]=true), if the message is already in the array, you ignore the bullet.  
So you are sure you count each bullet only once…but still you need some timer or way to delete the bullet from the table or the table will grow forever…maybe not the best way to handle it.

---

<div class="post-metadata">

**Author:** ![a-daniel](https://forum-defold.b-cdn.net/user_avatar/forum.defold.com/a-daniel/32/39781_2.png) [@a-daniel](https://forum.defold.com/u/a-daniel)\
**Post date:** [February 23, 2026, 7:57pm UTC](https://forum.defold.com/t/the-player-damage-taking-very-quickly/82419/3 "2026-02-23T19:57:30Z")

</div>

> [@Mathias](#):
>
> …but still you need some timer or way to delete the bullet from the table or the table will grow forever…

I think that the engine reuses the IDs of the game objects due to the “object pooling” that happens behind the scenes( [How to use object pooling?](https://forum.defold.com/t/how-to-use-object-pooling/41378) ) so the bullets table shouldn’t grow forever.

I don’t know if it’s a certain thing but In my case, the bullets table size is constant(around 20) after firing 1000s of bullets. The only thing to handle is setting bullets[id]=false after the collision is done.
