1
0
Fork 0
mirror of https://github.com/ninjamuffin99/Funkin.git synced 2025-02-04 02:38:16 +00:00

Fix issues with animation offsets breaking on restart on characters with high offstes.

This commit is contained in:
EliteMasterEric 2024-09-29 07:06:11 -04:00
parent e3ed153a7c
commit 90f6f80a71
3 changed files with 2 additions and 16 deletions

View file

@ -233,15 +233,9 @@ class BaseCharacter extends Bopper
*/
public function resetCharacter(resetCamera:Bool = true):Void
{
// Reset the animation offsets. This will modify x and y to be the absolute position of the character.
// this.animOffsets = [0, 0];
// Now we can set the x and y to be their original values without having to account for animOffsets.
// Set the x and y to be their original values.
this.resetPosition();
// Then reapply animOffsets...
// applyAnimationOffsets(getCurrentAnimation());
this.dance(true); // Force to avoid the old animation playing with the wrong offset at the start of the song.
// Make sure we are playing the idle animation
// ...then update the hitbox so that this.width and this.height are correct.

View file

@ -150,11 +150,8 @@ class Bopper extends StageProp implements IPlayStateScriptedClass
*/
public function resetPosition()
{
var oldAnimOffsets = [animOffsets[0], animOffsets[1]];
animOffsets = [0, 0];
this.x = originalPosition.x;
this.y = originalPosition.y;
animOffsets = oldAnimOffsets;
}
function update_shouldAlternate():Void

View file

@ -440,12 +440,7 @@ class Stage extends FlxSpriteGroup implements IPlayStateScriptedClass implements
character.x = stageCharData.position[0] - character.characterOrigin.x;
character.y = stageCharData.position[1] - character.characterOrigin.y;
@:privateAccess(funkin.play.stage.Bopper)
{
// Undo animOffsets before saving original position.
character.originalPosition.x = character.x + character.animOffsets[0];
character.originalPosition.y = character.y + character.animOffsets[1];
}
character.originalPosition.set(character.x, character.y);
var finalScale = character.getBaseScale() * stageCharData.scale;
character.setScale(finalScale); // Don't use scale.set for characters!