- Home /
Hide parts of the sprite in 2D?
Hello all! I don't know if I can clearly express what I am trying to achieve here but I will do my best.
I have a 2D project and I am working with sprites. One of my sprites is a creature that is instantiated every time my game begins. The appearance of the creature is based on some values they are assigned to it, and calculated randomly once the game begins.
The main characteristics of my sprites are horns and stripes. And I want to hide them if a value is lower than a fixed number. For example:
if the value of the horns is lower than the float number 20 then I want to show only the horns in the head. Not all the horns of my sprite. If the horns number is higher than 20, I want to show the horns in the back of my sprite as well. Same goes for stripes too, If the stripes number is lower than 20, then I want to see only the stripes in the head. Is there any way to achieve this? I have tried taking the original sprite and adding to it different children so I can activate them with layers. For example, the horns in the head are now a different sprite which is a child of the creature - sprite and I can activate them via script. But once I do that(add sprite children to the parent creature) , I am not able to assign on the sprite editor since it is now a prefab and not an image. Furthermore, since I already have animation for walking how can I pass an animation with parts of the sprite enabled or disabled? Even if I manage to assign the prefab on the sprite editor somehow, that would still be only one sprite as opposed for the 8 I have for my animation. Picture I use for my animation. I have sliced it in 8 16x16 windows so I can animate them.
I don't know how I can achieve this, thus I am asking for some advices and ideas! Hope I made some sense on what I am trying to do! Thanks for reading! Maybe this needs to go under Animation, dunno yet :(
Your answer
Follow this Question
Related Questions
A little question about sprites and RAM on a specific device?? 1 Answer
Is there a way to Update SpriteSheets without having to remake all the animations?? 1 Answer
2D Animated Background 0 Answers
How to call an sprite animation, hide the main character and show him again in another spot? 2 Answers
The parts of my character disappear when i use the animation 0 Answers