Sideview Battle Enemy Shadows

I've been manually putting shadows under my sideview enemy sprites. Most of the time it's not a problem, except when a skill is used on them like Piledriver which flips them upside-down, or Uppercut which send them soaring into the air. Then the shadow looks silly.
1742117723307.png

Any recommended workarounds? I imagine there are plugins to add shadows (in have the VisuStella basic plugins, don't see anything for enemies).

UPDATE: I couldn't find a plugin which did the job of adding shadows to side-view static enemy sprites so I've been working on this. It's not the best code, but it seems to do what I want. It even shrinks the shadows when I cast Mini on an enemy.

Code:
(() => {
    const _Sprite_Enemy_initialize = Sprite_Enemy.prototype.initialize;
    Sprite_Enemy.prototype.initialize = function(battler) {
        _Sprite_Enemy_initialize.call(this, battler);

        // Initialize shadow sprite
        this._shadowSprite = new Sprite();
        this._shadowSprite.anchor.set(0.5, 0.5);
        this._shadowSprite.visible = false; // Start hidden
        this.addChild(this._shadowSprite);

        // Initialize shadow scaling variable
        this._shadowScaleX = 1;
        this._shadowScaleY = 1;

        // Wait for all bitmaps to initialize
        this.waitForBitmapReady();
    };

    Sprite_Enemy.prototype.waitForBitmapReady = function() {
        // Check if enemy and shadow bitmaps are ready
        if (
                this.bitmap && 
                this.bitmap.isReady() &&
                this._shadowSprite &&
                (!this._shadowSprite.bitmap || this._shadowSprite.bitmap.isReady())
            ) {
            // All bitmaps are ready
            this.updateShadowScale();
            this._shadowSprite.visible = true;
        } else {
            console.debug("Bitmap not ready, retrying...");
            setTimeout(() => this.waitForBitmapReady(), 10); // Retry every 10ms
        }
    };

    Sprite_Enemy.prototype.updateShadowScale = function() {
        try {
            const enemyWidth = this.bitmap ? this.bitmap.width : 0;

            if (enemyWidth > 1) {
                const enemyScaleX = this.scale.x; // Horizontal scaling factor of the enemy
                const enemyScaleY = this.scale.y; // Vertical scaling factor of the enemy

                const shadowWidth = this.bitmap.width * enemyScaleX; // Scale shadow width
                const shadowHeight = shadowWidth / 8; // Maintain 8:1 ratio

                // Create a new bitmap for the shadow (ellipse)
                const shadowBitmap = new Bitmap(shadowWidth, shadowHeight);
                const centerX = shadowWidth / 2;
                const centerY = shadowHeight / 2;
                const radiusX = shadowWidth / 2;
                const radiusY = shadowHeight / 2;

                // Loops through all points the shadow rectangle area
                // Draw pixels in the rectangle which are also in the ellipse area
                for (let y = 0; y < shadowHeight; y++) {
                    for (let x = 0; x < shadowWidth; x++) {
                        const dx = (x - centerX) / (shadowWidth / 2);
                        const dy = (y - centerY) / (shadowHeight / 2);
                        if (dx * dx + dy * dy <= 1) {
                            shadowBitmap.fillRect(x, y, 1, 1, "#000000");
                        }
                    }
                }
                this._shadowSprite.bitmap = shadowBitmap;
                this._shadowSprite.opacity = 64; // Opaque is 255
                
                // Position the shadow below the enemy
                this._shadowSprite.x = 0;
                this._shadowSprite.y = this.y + this.height;
                
                // Scale the shadow to match the enemy
                this._shadowSprite.scale.x = enemyScaleX;
                this._shadowSprite.scale.y = enemyScaleY;
            } else {
                console.debug("Enemy bitmap width invalid; retrying...");
                setTimeout(() => this.updateShadowScale(), 5);
            }
        } catch (error) {
            console.error("Error in updateShadowScale:", error);
        }
    };

    const _Sprite_Enemy_update = Sprite_Enemy.prototype.update;
    Sprite_Enemy.prototype.update = function() {
        try {
            _Sprite_Enemy_update.call(this);
            if (this._shadowSprite) {
                this._shadowSprite.visible = this.visible;
            }
        } catch (error) {
            //console.error("Error in update:", error);
        }
    };

    const _Sprite_Enemy_destroy = Sprite_Enemy.prototype.destroy;
    Sprite_Enemy.prototype.destroy = function() {
        
        try {
            if (this._shadowSprite) {
                this.removeChild(this._shadowSprite);
                this._shadowSprite.bitmap = null;
                this._shadowSprite = null;
            }
            _Sprite_Enemy_destroy.call(this);
        } catch (error) {
            console.error("Error in destroy:", error);
        }
    };
})();
Reading your plugin parameters should be a pretty good workaround.
Battle core says:
1742139538445.png
Reading your plugin parameters should be a pretty good workaround.
Battle core says:
View attachment 334555
I tried that, it didn't work. My reading of the documentation, and the image that accompanies it in the BatleCore web page, is that the shadow only works if you use enemies which use the Animated Sideview Actor graphics. I don't want my enemies to look like Chibi characters, so I was hoping there was another plugin out there which did the job.
don't want my enemies to look like Chibi characters
I don't understand. The shadow works only if you have Chibi characters? Perhaps I'm missing something but that doesn't make any sense.

EDIT: tested it and the shadows show with non-chibi enemy battlers too.

1742187819894.png
I don't understand. The shadow works only if you have Chibi characters? Perhaps I'm missing something but that doesn't make any sense.

EDIT: tested it and the shadows show with non-chibi enemy battlers too.

View attachment 334650
I must be missing something.
I've set Shadow Visible to true in the BattleCore plugin.
I've added the
<Sideview Show Shadow>
to my enemies Notetag. I even added
<Sideview Shadow Scale: 100%>
just in case the shadow size was defaulting to 0%.
I even tried closing and reopening the game.
But my Yoblin is still sans shadow (his sister GobLynn has her shadow as part of her sprite)

1742188898479.png

1742189306634.png


1742189353714.png
Could it be because you're using static battlers? Can't test it in any of my projects cause using static battlers causes things to bug out.
Could it be because you're using static battlers? Can't test it in any of my projects cause using static battlers causes things to bug out.
I suspect that is the case, yes.
If the shadows only work for animated enemies, you can use GIMP to copy paste your enemies 6x9 and use animated battlers (they don't have to be chibis). That way they appear static, since it's the same image.

But even if the shadow stays below, it might not look too good when the enemy flies up. Maybe you can find another shadow plugin that works with VS. Or have you tried changing the enemy sprite to one with no shadow in the action sequences. Here's a thread with something that they say works with VS (though didn't check if the plugin allows to change per troop member or just enemy id):
If the shadows only work for animated enemies, you can use GIMP to copy paste your enemies 6x9 and use animated battlers (they don't have to be chibis). That way they appear static, since it's the same image.

But even if the shadow stays below, it might not look too good when the enemy flies up. Maybe you can find another shadow plugin that works with VS. Or have you tried changing the enemy sprite to one with no shadow in the action sequences. Here's a thread with something that they say works with VS (though didn't check if the plugin allows to change per troop member or just enemy id):
Thanks for the ideas. I ended up created a plugin from scratch (code above)

Original thread: https://forums.rpgmakerweb.com/threads/sideview-battle-enemy-shadows.176280/