How to disable shadows on 2D platforms ?

kimono

Well-known member
Good evening everyone,
I'd like to know if you have a tip for disabling the shadow on a platform or making it appear only if a panel is present.

Indeed, in this case, it can't extend over the background.

Thank you :)
 

Attachments

  • My Mod - 0002.png
    My Mod - 0002.png
    24.2 KB · Views: 4
The second parameter of gfxshadow has one for no shadow which is set to 1.
gfxshadow {int} {shadowbase}

  • Changes entity's shadow effect.
    • 0 = (default) Use generic shadow set.
    • 1 = Use entity's current frame for the shadow. Yes, the shadow will be more realistic with this. The angle and length of shadow is defined by 'light' (see below).
  • {shadowbase} controls how the shadow works in platforms (4287+)
    • gfxshadow 1 = default gfxshadow
    • gfxshadow 1 0 = default gfxshadow
    • gfxshadow 1 1 = no shadow changes on platform/basemap (old builds)
    • gfxshadow 1 2 = 2D-like shadow (like platform games)
    • gfxshadow 1 3 = combination 1+2
handable via script with new "shadowbase" prop in entityproperty

Code:
name hero
type player
gfxshadow 1 1
health 100
 
Thanks maxman, I would like to disable the shadow only when the entities are on a platform.
You're right. Just tested it and it looks weird when there's your shadow below you.

Anyway. I couldn't record a video, and my video recorder is not working, but I can tell you what the result is like from my end. You're on the very ground when there's shadow, but when you jump to the platform and then land, you'll see that there's no shadow. You can see your shadow while jumping (from the ground) before landing to a platform. You also jump to the other platform while there's no shadow at all. When you jump off from the platform to return to the very base, you see your shadow again.

This is what I made which I just named it, shadowbase.c.

shadowbase.c:
C:
void main(){
    void self = getlocalvar("self");
    int y = getentityproperty(self, "y");
    int base = getentityproperty(self, "base");

    if(base){
        changeentityproperty(self, "gfxshadow", 0);
    }if(base == 0 && y < 1){
        changeentityproperty(self, "gfxshadow", 1);
        changeentityproperty(self, "shadowbase", 2);
    }
}

Declare it as onmoveascript in your header.
Code:
onmoveascript data/scripts/shadowbase.c

I don't know how exactly you want it, but this is what I got.
 
Last edited:
Back
Top Bottom