Greetings,
In my game, I have a group that contains everything that hurts players and enemies, with checks to see which one hurts which for convenience sake.
Each thing has a damage value, from the player’s attack projectile to enemy bullets.
In this example, the bullets do 2 damage, and the player’s attack does 3 damage. I even have a mechanic that let’s me stall the attack on an enemy.
However, something really strange happens:
If you look closely, when I stall my attack on an enemy (3 damage), the bullets (2 damage) will also do 3 damage to the enemies behind…???
They aren’t supposed to share damage, so I have no idea what’s causing this…
In my code, I have it set up so that everything in the group pulls from a damage variable to deal it’s own damage (Using the new group variable feature):
The player attack damage is calculated like this:
Bullets are spawned from a temporary bullet spawner, which sets the values of the spawned bullets like so:
This has left me scratching my head. How can I fix this bug and make it so that the player’s attack doesn’t interfere with the enemy bullet’s damage value?
EDIT: I’ve decided to use a ForEach group and it seems to work, although, now there’s an even crazier issue present:
At appears that when I throw my attack out, the lifespan of the bullets drastically reduce? Why??
On top of that, when I tab out, the bullet’s lifespan is too long???
Here’s the code that spawns a bulletSpawner object to shoot a bullet:
I was trying to ball everything up for convenience sake, but is it a bad idea?
EDIT 2: I’ve added lifespan checkers to each bullet, which determines the lifespan when each bullet “dies,” and uh…
(1 and 2 pinpoints where the bullets were deleted, basically their destination points)
So yeah, how can I make it so that the lifespan stays consistent every time? I’m totally lost for clues at this point…