Jump to content

Best way to handle Character with shadow


Nephelococcygia
 Share

Recommended Posts

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 ?

Thanks.

Link to comment
Share on other sites

On 28. 1. 2018 at 8:06 PM, Nephelococcygia said:

- (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;

this is the best option in my opinion.

Link to comment
Share on other sites

 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...