Discuss Scratch

Loopsy54
Scratcher
19 posts

Damage Indicators

I'm making a game where different weapons do different amounts of damage and inflict debuffs. I want to make little number damage indicators but don't know how, if anyone does then please tell me.
Oumuamua
Scratcher
1000+ posts

Damage Indicators

But, when and where the number should display?
it is better to share the project…
Loopsy54
Scratcher
19 posts

Damage Indicators

The number should display when the enemy takes damage and at the enemy, i want it to appear and rise while disappearing

Last edited by Loopsy54 (Nov. 26, 2022 20:24:42)

danger695
Scratcher
100+ posts

Damage Indicators

Loopsy54 wrote:

The number should display when the enemy takes damage and at the enemy, i want it to appear and rise while disappearing
Well, you could make a sprite with the damage indicator clone itself whenever the player hits an enemy. You can then make the damage indicator clone go to the enemy that was just hit. You could also make the damage indicator clone go to the sword. For the fading in and out part, you could do something like this:
set [ghost v] effect to (100)
repeat (10)
change x by (1)
change [ghost v] effect by (-10)
end
repeat (10)
change x by (-1)
change [ v] effect by (10)
end
delete this clone

Last edited by danger695 (Nov. 26, 2022 21:52:19)

Loopsy54
Scratcher
19 posts

Damage Indicators

yes but how would the indicator know what enemy to go to and how much (my enemies are clones)
SonicTester
Scratcher
40 posts

Damage Indicators

In the enemy script for handling damage collision you could have something like this:

(in a run without screen refresh custom block)
set [enx v] to (x position)
set [eny v] to (y position)
set [dmg v] to (damage)
broadcast [display damage counter v]
In the damage counter you could then get the enemy's X and Y from enx and eny and the damage level from dmg.

Alternatively (the way I prefer to do it) is have the damage counter inside of the Entity sprite and have it set a this sprite only flag.
However that's a bit more complicated.

Last edited by SonicTester (Nov. 29, 2022 20:58:21)

Loopsy54
Scratcher
19 posts

Damage Indicators

What would the script in the counter look like, and how would it know which clone to go to at what ime?

Last edited by Loopsy54 (Nov. 29, 2022 22:04:20)

Powered by DjangoBB