Funkin icon indicating copy to clipboard operation
Funkin copied to clipboard

Bug Report: Scaled Characters float away the more they sing

Open WuffGaming opened this issue 1 year ago • 1 comments

In all 3.0.# versions, scaled character sprites using the built in ""scale":" feature float away depending on their size. This makes it impossible to use sprites that need to be scaled up.

WuffGaming avatar May 04 '24 17:05 WuffGaming

You can fix that

go to ... yourmod/scripts/characters/ and create your character script yourcharactername.hxc

and copy this, but change names!

import funkin.play.character.SparrowCharacter;

class YourCharNameCharacter extends SparrowCharacter {
    function new() {
        super('yourcharacter');
    }
    
	// script by Nebula_Zorua
	// retry fix by TormentedProgram
	// please leave this credit in
	
    override function set_animOffsets(value:Array<Float>) {
        if(animOffsets == null)
            animOffsets = [0, 0];
        
        if(animOffsets[0] == value[0] && animOffsets[1] == value[1])
            return value;

        var scaleX = scale.x / (isPixel ? 6 : 1);
        var scaleY = scale.y / (isPixel ? 6 : 1);

        var scaledNewX = value[0] * scaleX;
        var scaledNewY = value[1] * scaleY;
        var scaledOldX = animOffsets[0] * scaleX;
        var scaledOldY = animOffsets[1] * scaleY;
        var xDiff = scaledOldX - scaledNewX;
        var yDiff = scaledOldY - scaledNewY;

        x = x + xDiff;
        y = y + yDiff;

        animOffsets[0] = value[0];
        animOffsets[1] = value[1];

        return value;
    }

    override function onCountdownStart(event) {
        super.onCountdownStart(event);
        setScale(_data.scale); 	//scale breaks on retry this fixes that
    }
}

Mlaofmd avatar Jun 22 '24 23:06 Mlaofmd

Stale issue, fixed in v0.5.0.

AbnormalPoof avatar Oct 09 '24 13:10 AbnormalPoof