FunkinCrew / Funkin

A rhythm game made with HaxeFlixel
https://www.newgrounds.com/portal/view/770371
Other
2.97k stars 2.29k forks source link

Enhancement: Automatically correct character animation offsets when flipX is used. #3335

Open cyn0x8 opened 1 month ago

cyn0x8 commented 1 month ago

Issue Checklist

What is your suggestion, and why should it be implemented?

currently, if a character is created and used in the player slot (flipX is true), the offsets will become inconsistent unless they were specifically designed around the character being used in the player slot

itd be nice if we could just have a single character json usable in either character slot and their offsets consistent like with this code, eliminating the need for a separate "player" version of the character

[!note] this change would break older characters, so it probably needs to be under a new character version like 1.1.0

EliteMasterEric commented 1 month ago

I can look into this definitely. Shouldn't be too difficult.

NOTE: If a PR for this already exists please link that so I can merge it and give people credit for their work.

EliteMasterEric commented 1 month ago

Going to implement this now, I'm going to see if I can make you a co-author on the commit without you having to do anything...

dombomb64 commented 1 month ago

Before this gets closed, I want to point something out with playable versions of opponents. If pico-playable is going to get merged into pico, there should probably be a check for if bf.characterId == dad.characterId (for example, the Week 3 Pico Mixes), and if they’re the same, then the game instead checks for Voices-pico-p0-picoMix.ogg and Voices-pico-p1-picoMix.ogg rather than them both pointing to Voices-pico-picoMix.ogg.

cyn0x8 commented 1 month ago

Before this gets closed, I want to point something out with playable versions of opponents. If pico-playable is going to get merged into pico, there should probably be a check for if bf.characterId == dad.characterId (for example, the Week 3 Pico Mixes), and if they’re the same, then the game instead checks for Voices-pico-p0-picoMix.ogg and Voices-pico-p1-picoMix.ogg rather than them both pointing to Voices-pico-picoMix.ogg.

i didnt think about that!! thats a great suggestion

MidyGamy commented 1 month ago

For an old engine of mine I used Voices.ogg for the player voices and OppVoices.ogg for the opponent, making load this by default if the voices specific to the character doesn't exist

EliteMasterEric commented 1 month ago

Before this gets closed, I want to point something out with playable versions of opponents. If pico-playable is going to get merged into pico, there should probably be a check for if bf.characterId == dad.characterId (for example, the Week 3 Pico Mixes), and if they’re the same, then the game instead checks for Voices-pico-p0-picoMix.ogg and Voices-pico-p1-picoMix.ogg rather than them both pointing to Voices-pico-picoMix.ogg.

Note that aside from pico-playable having different offsets, it also exists due to having a seperate set of animations than pico. The shooting, missing, and burping animations do not need to be loaded during Week 3.

dombomb64 commented 1 month ago

I guess that’s true. While I was doing something with the files of the game recently, I found out that there are two fields in the metadata json that will override the opponent and player vocal paths if set, so that could be used if somebody decides to make a character Confront Themselves™.

AbnormalPoof commented 1 month ago

Pretty sure this code from the 0.2.8 codebase did this:

        if (isPlayer)
        {
            flipX = !flipX;

            // Doesn't flip for BF, since his are already in the right place???
            if (!curCharacter.startsWith('bf'))
            {
                // var animArray
                var oldRight = animation.getByName('singRIGHT').frames;
                animation.getByName('singRIGHT').frames = animation.getByName('singLEFT').frames;
                animation.getByName('singLEFT').frames = oldRight;

                // IF THEY HAVE MISS ANIMATIONS??
                if (animation.getByName('singRIGHTmiss') != null)
                {
                    var oldMiss = animation.getByName('singRIGHTmiss').frames;
                    animation.getByName('singRIGHTmiss').frames = animation.getByName('singLEFTmiss').frames;
                    animation.getByName('singLEFTmiss').frames = oldMiss;
                }
            }
        }

Though this basically just swapped singRIGHT/singLEFT, so this is probably not suitable lol