Floating Damage Numbers

ozz

  • *
  • Posts: 575
I'm trying to create a Behavior that draws numbers that float up above the actors after they take damage like in many RPGs.  What's the best way to do that?

merrak

  • *
  • Posts: 2738
I often use the Image API to draw the number, then move it for a bit. If there's less variation, I'll use actors instead.

corbanwolf

  • Posts: 223
You can create an actor type that has empty image.
Then when you calculate the damage, create that empty actor at the X and y of enemy. Then give that empty actor an attribute number with the number.
When drawing behaviour. Draw that number. Set opacity of text as the opacity of actor.
When created. tween opacity to zero over 1 sec. Set y speed to -2. After 2 sec kill or something.

I got an old behaviour somewhere. I will try to find it later

[edit]
attached behaviour. I made it long ago. It works. Looks complicated but does the work.

« Last Edit: June 20, 2020, 10:40:29 pm by corbanwolf »
♪♪♪♪♪♪

ozz

  • *
  • Posts: 575
 Thanks, this looks great, I'll try this out.