I use AndEngine, And I need to drop shadow for sprite.
In sprite I use png texture. Can I draw shadow in code, or need draw it on Photoshop and impose under sprite?
If you really (!) need to create shadows dynamically then you could do something like this:
(removed)
Update
An easier way came into my mind:
Create a RenderTexture.
Render your Sprite to the RenderTexture several times with different scales and alpha values. i.e. scale=1, alpha=1 / scale=1.1, alpha=0.9 / scale=1.2, alpha=0.8 etc. Use as small steps as possible to achieve a smooth gradient.
Create a Sprite using your RenderTexture and set its color to black (Color.Black).
2
Answers
You have to create shadow as PNG file, attach it to your sprite and make it visible when needed. Can’t create shadows dinamically in andEngine.
If you really (!) need to create shadows dynamically then you could do something like this:
(removed)
Update
An easier way came into my mind:
RenderTexture
.Sprite
to theRenderTexture
several times with different scales and alpha values. i.e. scale=1, alpha=1 / scale=1.1, alpha=0.9 / scale=1.2, alpha=0.8 etc. Use as small steps as possible to achieve a smooth gradient.Sprite
using yourRenderTexture
and set its color to black (Color.Black
).