Indeed - the 2D Demo game's Brain2D player prefab demonstrates this technique.
Attach it as a child of the main sprite child, then make sure your Follow Sorting Map component (on the main sprite) has Offset original Order? checked. This will make sure the relative difference in sorting order between your main sprite and shadow sprite will be retained.
Another question about this... When the character walks, the legs are in movement (logically), but the shadow not changes your size according the separation of the legs. Is there a way to assign a different shade for each sprite movement?
In my opinion, this is highly complex for a such an unimportant detail that no player would care or notice much You would need to take into account the lights placements calculate an angle, adjust a distortion to the shadow and make the shadow rotate dynamically, what if your lights sources are moving?
If you really want a more or less detailed legs, arms, torso, head shadows you would need to make a sprite sheet animation and child it to your main 2d character as semi-transparent animation. All in all lots of troubles and work. Surely just a childed semi-transparent squished oval dark spot to the bottom of your charcter won't get bad reviews from your players
I don't know what budget you have but spending time and money on it wouldn't bring more sells. Some work pipeline strategy rethiniking might be required in order to complete your game.
I not really intend to do something so complex. Before using "AC" used WME (Wintermute problem is that this engine is that it is only for PC), and allowed to use a "subsprite" or sprite "children" in each sprite, so that when the animation is created each sprite had a sprite for shade.
Thanks for the answers. I think the best option is to include the sprite shadow on the main sprite animation.
Sorry to necro an old post. I tried this and it works great but can cause some issues with collision with the navmesh since the shadow object is below the feet. Is there any way to fix this?
Wow I didn't think about repositioning the collider, that is very simple and solves issues I had with cropping on my animation frames. Thank you Rairun!
Comments
Attach it as a child of the main sprite child, then make sure your Follow Sorting Map component (on the main sprite) has Offset original Order? checked. This will make sure the relative difference in sorting order between your main sprite and shadow sprite will be retained.
Another question about this... When the character walks, the legs are in movement (logically), but the shadow not changes your size according the separation of the legs. Is there a way to assign a different shade for each sprite movement?
Thanks again!
The shadow should change with every movement of sprites...
notice much You would need to take into account the lights placements calculate an angle, adjust a distortion to the shadow and make the shadow rotate dynamically, what if your lights sources are moving?
If you really want a more or less detailed legs, arms, torso, head shadows you would need to make a sprite sheet animation and child it to your main 2d character as semi-transparent animation.
All in all lots of troubles and work.
Surely just a childed semi-transparent squished oval dark spot to the bottom of your charcter won't get bad reviews from your players
I don't know what budget you have but spending time and money on it wouldn't bring more sells.
Some work pipeline strategy rethiniking might be required in order to complete your game.
Thanks for the answers. I think the best option is to include the sprite shadow on the main sprite animation.
Sorry to necro an old post. I tried this and it works great but can cause some issues with collision with the navmesh since the shadow object is below the feet. Is there any way to fix this?
Yeah, it's simple! You just need to reposition the character's collider to coincide with the feet.
Wow I didn't think about repositioning the collider, that is very simple and solves issues I had with cropping on my animation frames. Thank you Rairun!