skip to Main Content

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?enter image description here

2

Answers


  1. 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.

    Login or Signup to reply.
  2. 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).
    • There you have your dynamic shadow 😉
    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search