0 votes

now if i attack an enemy 30 times he die then if attack another enemy hi dies after the first attack

the project :

https://drive.google.com/open?id=1Og_M7c6-DKPfKJ36awsa_6ohmD4_6Xr4

in Engine by (70 points)

1 Answer

0 votes

It seems the problem is that you did not connect the signals to the enemy2 instance. This meant that every time you hit an enemy (didn't matter which one), it always damaged the enemy node and never the enemy2 node.

For the hit signal from the player, you needed to connect for enemy2:
enter image description here

Same for the attack_entered signal:
enter image description here

And the enter_entered:
enter image description here

Here is a zip of the working project: https://drive.google.com/file/d/1Pz1jA7qosIve-t5ppj6aPx7yQf-mrbwK/view?usp=sharing Note that I changed the damage done from 1 to 100 so that you don't have to hit it so many times in order to test.

by (1,616 points)

thanks doud thank you

Welcome to Godot Engine Q&A, where you can ask questions and receive answers from other members of the community.

Please make sure to read How to use this Q&A? before posting your first questions.
Social login is currently unavailable. If you've previously logged in with a Facebook or GitHub account, use the I forgot my password link in the login box to set a password for your account. If you still can't access your account, send an email to webmaster@godotengine.org with your username.