Posted January 27, 2024 by NotArcane
The Problem
One issue I was running into was having melee attacks being unable to attack multiple times in a row. My main issue came from the fact that there were some issues with trying to implement the functionality without having to create a lot of dependencies between different moving parts of the game. The main problem with this, of course, is that many components of the game being dependent on each other makes the game run slower as it has to open and read the information it needs from those other components which could also have other things it depends on and needs to read.
The Solution
As you can see in the debugging window on the bottom part of the screenshot, you can tell that there was functionality added for damaging an enemy multiple times. The way I accomplished this was actually much simpler than I was thinking about initially. What I did was actually create a list of different enemies and damageable components in the weapon's code and store what was available to be damaged and needed to be damaged. With this list, I could easily modify it by either adding or removing different components based on if it entered or left the attack hitbox and then damaged what was in my hitbox.