followed this tutorial : https://www.youtube.com/watch?v=UlvBqz8bhCo
the guy is working mostly in 2D, i tried to apply the same method but I'm hating working with UI in godot, everytime I seem to get something right, I get 100 more wrong.
the problem I'm having is that when I hit multiple enemies, only one damage indicator shows
so basically in the code the func _ready() animates the damage indicator making it shrinks after it appears... and the self.queue_free() deletes the damage after the animation is complete
I'm using a third person controller with a crossair, the damage shows offset to the left of the crossair, which is perfect for now... but no matter how many enemies I hit... only one damage pop up shows... even when enemies have different ammounts of defense so it should show diferent damage texts... it only ever shows the damage of the first enemy hit
the floating damage is called by the enemy when it is hit
there is the full enemy.gd code https://github.com/Ceisri/Godot-Action-Combat/blob/main/Creatures/Enemies/Enemy.gd
The player calls the function that damages the enemies with :
func attack():
var enemies = hitbox.get_overlapping_bodies()
for enemy in enemies:
if enemy.has_method("onhit"):
#enemy.hurt()
enemy.onhit(damage)
which is the mirrored version of the Enemy script... , it also has the function to be damaged:
func onhit(damage):
$GUI/HealthBar.value = int((health / maxhealth) * 100)
health -= (damage - defense)
staggered = true
it basically gets the (damage) from the enemy and the (defense) from the player... the opposite happens when the enemy is being hit.
so aggressor damage - victim defense = damage caused to victim
floatingtext
. And it is still done as a screenshot and not as text. \$\endgroup\$Enemy.onhit(damage)
called? \$\endgroup\$