I am creating a game that has multiple enemies so I made a group, and when an enemy is hit I update the variable to +1, but the problem is when I hit one enemy, then the second one 2 times, the second enemy is deleted, as I put that the variable needs to be 3, so that the enemy can take 3 hits before gone.
Can anyone help me, so that the variable applies, so when I hit one enemy 2 times it only applies to that enemy, and not all of them combined?
Is “Enemy” a group or an object? You are changin a scene variable “EnemyHit” and taking the info from a scene variable to say if “Enemy” will be deleted or not. If another enemies are taking the info from that scene variable too so, they will be deleted. I suggest you to use object variable for every kind of enemy to take the info (so you would add 1 to an object variable of every type of enemy if the ball is colliding with an enemy).
You have to adapt it to your game. Maybe if there are a lot of balls at the same time in your game that hit your enemies, you should try it without “trigger once”.
Also, I have multiple enemies (copies of one object, and I think that is causing the issue), wished there was a way to use one object and duplicate it and treat it as 1 enemy each, but I guess that is not possible for now.
When I created that example, I put a lot of objects from each enemy and they all respond as an individual enemy (the rocket collision only adds 1 to the variable of the specific object it was hitting). Isn’t it working for you?