Funkin icon indicating copy to clipboard operation
Funkin copied to clipboard

Bug Report: [Character's offsets change when hitting notes if their scale is different from 1]

Open Venesio opened this issue 1 year ago • 1 comments

Please check for duplicates or similar issues, as well performing simple troubleshooting steps (such as clearing cookies, clearing AppData, trying another browser) before submitting an issue.

If you are playing the game in a browser, what site are you playing it from?

If you are playing the game in a browser, what browser are you using?

  • [ ] Google Chrome (or chomium based like Brave, vivaldi, MS Edge)
  • [ ] Firefox
  • [ ] Safari

What version of the game are you using? Look in the bottom left corner of the main menu. (ex: 0.2.7, 0.2.1, shit like that)

v0.3.2

Have you identified any steps to reproduce the bug? If so, please describe them below in as much detail as possible. Use images if possible.

image

https://github.com/FunkinCrew/Funkin/assets/97074204/1ab2c63a-461c-4a48-8414-bf21c3e76081

Please describe your issue. Provide extensive detail and images if possible.

If the character's scale is different from 1 in their JSON file, their offsets change with each animation and they start flying to another direction.

If you're game is FROZEN and you're playing a web version, press F12 to open up browser dev window, and go to console, and copy-paste whatever red error you're getting

Venesio avatar May 18 '24 06:05 Venesio

Such things are always bound to happen due to offsets not being calculated with the scale and I don't think they're ever gonna fix this.

objShaggy avatar May 18 '24 06:05 objShaggy

https://github.com/gusborg88/fnf-porter

We're encountering this issue a LOT when we import the scale value from Psych Engine characters to Base Game that use the scale value.

SoffiMeower avatar May 26 '24 01:05 SoffiMeower

Really hope this issue gets fixed.

SarahDrewington avatar Jun 07 '24 19:06 SarahDrewington

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

Pretty sure this is fixed in v0.5

EliteMasterEric avatar Sep 28 '24 15:09 EliteMasterEric