I was wondering what is the best way to handle shadow for a "character".
I made a character and i want to put a shadow at the bottom a kind of "circle" with opacity, for convenience let's say it's gonna be a transparent PNG.
The way i can think of :
- (1) Just add the sprite to the game, this leads to duplicated calculations in the update part cause i have to update both the "character" sprite and his shadow;
- (2) Add the shadow as a child sprite of the "character", this leads to having the shadow on top of the sprite instead of back to it;
- (3) Add the "character" sprite as a child of the shadow sprite, this seems not logical, but it works somehow;
- (4) Create a group and add both the shadow and the sprite, (havn't test it but most likely) this leads to define specific property to the group for the size, the position and the overflow boundaries for collision relative to the "character" sprite and the shadow;
- (5) Using a filter (Shader) applied on the hole game, with my character position as uniform to render the shadow directly on the "groundLayer".
What do you think please ? Is there a better way that i am missing ?