mirror of
https://github.com/FunkinCrew/Funkin.git
synced 2025-05-23 11:07:00 -04:00
Fix issues with animation offsets breaking on restart on characters with high offstes.
This commit is contained in:
parent
e3ed153a7c
commit
90f6f80a71
3 changed files with 2 additions and 16 deletions
source/funkin/play
|
@ -233,15 +233,9 @@ class BaseCharacter extends Bopper
|
||||||
*/
|
*/
|
||||||
public function resetCharacter(resetCamera:Bool = true):Void
|
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.
|
// Set the x and y to be their original values.
|
||||||
// this.animOffsets = [0, 0];
|
|
||||||
|
|
||||||
// Now we can set the x and y to be their original values without having to account for animOffsets.
|
|
||||||
this.resetPosition();
|
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.
|
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
|
// Make sure we are playing the idle animation
|
||||||
// ...then update the hitbox so that this.width and this.height are correct.
|
// ...then update the hitbox so that this.width and this.height are correct.
|
||||||
|
|
|
@ -150,11 +150,8 @@ class Bopper extends StageProp implements IPlayStateScriptedClass
|
||||||
*/
|
*/
|
||||||
public function resetPosition()
|
public function resetPosition()
|
||||||
{
|
{
|
||||||
var oldAnimOffsets = [animOffsets[0], animOffsets[1]];
|
|
||||||
animOffsets = [0, 0];
|
|
||||||
this.x = originalPosition.x;
|
this.x = originalPosition.x;
|
||||||
this.y = originalPosition.y;
|
this.y = originalPosition.y;
|
||||||
animOffsets = oldAnimOffsets;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function update_shouldAlternate():Void
|
function update_shouldAlternate():Void
|
||||||
|
|
|
@ -440,12 +440,7 @@ class Stage extends FlxSpriteGroup implements IPlayStateScriptedClass implements
|
||||||
character.x = stageCharData.position[0] - character.characterOrigin.x;
|
character.x = stageCharData.position[0] - character.characterOrigin.x;
|
||||||
character.y = stageCharData.position[1] - character.characterOrigin.y;
|
character.y = stageCharData.position[1] - character.characterOrigin.y;
|
||||||
|
|
||||||
@:privateAccess(funkin.play.stage.Bopper)
|
character.originalPosition.set(character.x, character.y);
|
||||||
{
|
|
||||||
// Undo animOffsets before saving original position.
|
|
||||||
character.originalPosition.x = character.x + character.animOffsets[0];
|
|
||||||
character.originalPosition.y = character.y + character.animOffsets[1];
|
|
||||||
}
|
|
||||||
|
|
||||||
var finalScale = character.getBaseScale() * stageCharData.scale;
|
var finalScale = character.getBaseScale() * stageCharData.scale;
|
||||||
character.setScale(finalScale); // Don't use scale.set for characters!
|
character.setScale(finalScale); // Don't use scale.set for characters!
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue