You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
So I have bullets assigned to the filter 'cross', because they penetrate through multiple enemies. However, I've noticed that the damage for the bullets is called EVERY FRAME they are colliding with the enemy, not once per collision - if the bullet deals 3 damage and collides with an enemy for 2 frames before passing to the next one, the enemy will recieve 6 damage. A similar thing happens with the enemy attacks that have big hitboxes to the player - a attack may deal 2 damage, but if the player is in the hitbox for 5 frames it deals 10 damage. How do I fix this?
The text was updated successfully, but these errors were encountered:
Games generally have this ting called "i-frames"; essentially when the player gets damaged you give them a brief period of invulnerability in which they cannot be damaged further. Alternatively, you could delete the bullet when it collides with the player, depends on what you're doing with your game... you could perhaps also have a variable that stores whether a collision has happened last frame and ignore it if it has?
(alternatively, for some reason checking if collisions[i].ti is non-negative seems to only be true once per collision, so that could work? not sure why that happens though, we're new at this, but hope that helps)
So I have bullets assigned to the filter 'cross', because they penetrate through multiple enemies. However, I've noticed that the damage for the bullets is called EVERY FRAME they are colliding with the enemy, not once per collision - if the bullet deals 3 damage and collides with an enemy for 2 frames before passing to the next one, the enemy will recieve 6 damage. A similar thing happens with the enemy attacks that have big hitboxes to the player - a attack may deal 2 damage, but if the player is in the hitbox for 5 frames it deals 10 damage. How do I fix this?
The text was updated successfully, but these errors were encountered: