#problem with showing damage numbers

8 messages · Page 1 of 1 (latest)

civic sorrel
#

hi, is there an error message when you get the crash?

#

also what exactly is the intended behavior?
is it to spawn a HealthNumberDisplayComponent when you hit, and it does some animation and then disappears?

#

ohh i see, the entity has the display component and sets its text and stuff and tells it to animate, and at the end its destroying it, which means it can't do it a second time since its gone

#

What you want to do is save the display component as a separate scene, and when something is damaged you create a copy, and then delete it when its done. I found a short tutorial that does it a similar way but puts the animation code in a different area.
https://www.youtube.com/watch?v=F0DQLSiLkjg

RPG inspired damage numbers are a great way to implement visual feedback to the effectivness of the player's actions in your indie game. Even games that are not strictly RPGs implement them - Stardew Valley, Slay the Spire and Borderlands, among others, are great examples of utilizing damage numbers in combat. Implementing them into your Godot i...

▶ Play video
#

also instead of calling remove_child, you want to use queue_free(), which removes it and deletes it from memory, and makes sure it does it at the end of the game tick

paper finch
#

but works fine now

#

just need to do some tweeking