Showing damage on sprite - how to?
Is there any other way to show damage on sprite (ex. on bricks) than creating damaged sprite and changing it after hit? Maybe some material magic or so?
Edit: Basicly i want to recreate space invaders game and i wonder if i must create shiled from "bricks" or is there any other way to make gameobject that behave like this. Link: http://www.pacxon4u.com/space-invaders/
@czater Do you want to show same sprite as damaged form or just change the correct sprite with damaged one ??
public Image yourImage;
public Sprite damagedSprite;
// for changing sprite
yourImage.sprite == damagedSprite;
best for me would be if i can use same sprite for normal and damaged. I mean damaged= normal sprite + some magic staff (shader or sth?) and I wonder if it is possible to do this this way.
I've converted this to a comment, I know it isn't obvious but the big Reply link is actually to post an Answer! If you want to reply a small reply appears to the right of the name of the poster you reply to, helpfully (not) it's invisible unless you hover over it.
@czater As far as I know, there is no such way in unity that you are searching.
I'm having trouble with that link so I will do my best to guess and make recommendations in the form of a comment. $$anonymous$$y recommendations would be (some of these may require the elements to be UI images rather than sprite renderers): 1) just swap them. it's a good idea, it's simple and flexible. I know that's not helpful if you're looking for an alternative, but it is my first recommendation. 2) keep the sprites as white (if possible) and set their color in the inspector according to their damage state. 3) Use a second sprite on top that fades in as damage increases (or for UI sprites, fills in using radial / linear fill) 4) There are, indeed, a large number of material effects and special effect packs in the asset store available that might give you something to work with that you can turn on and off easily.
Answer by xpcrepair23 · Dec 31, 2020 at 10:39 PM
For loop with inner loop and generate the shield from small bricks and destroy as they are shot..
Check out mine. https://youtu.be/xDJ4zzxvqpU
Your answer
Follow this Question
Related Questions
Help with Changing Sprites in Code (c#) 0 Answers
Changing Sprites in Code (c#) help 0 Answers
My decal sticks out of background like crap in a cup of coffee 0 Answers
How to change bullet on impact? 3 Answers
can't damage spawned prefab 1 Answer