Skip to content

Commit

Permalink
Fix animation offsets for characters/boppers with scale
Browse files Browse the repository at this point in the history
  • Loading branch information
gamerbross committed Jul 6, 2024
1 parent 9908f97 commit 7daf6ab
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions source/funkin/play/character/BaseCharacter.hx
Original file line number Diff line number Diff line change
Expand Up @@ -124,8 +124,8 @@ class BaseCharacter extends Bopper
if ((animOffsets[0] == value[0]) && (animOffsets[1] == value[1])) return value;

// Make sure animOffets are halved when scale is 0.5.
var xDiff = (animOffsets[0] * this.scale.x / (this.isPixel ? 6 : 1)) - value[0];
var yDiff = (animOffsets[1] * this.scale.y / (this.isPixel ? 6 : 1)) - value[1];
var xDiff = (animOffsets[0] - value[0]) * (!this.isPixel ? this.scale.x : 1);
var yDiff = (animOffsets[1] - value[1]) * (!this.isPixel ? this.scale.y : 1);

// Call the super function so that camera focus point is not affected.
super.set_x(this.x + xDiff);
Expand Down
4 changes: 2 additions & 2 deletions source/funkin/play/stage/Bopper.hx
Original file line number Diff line number Diff line change
Expand Up @@ -95,8 +95,8 @@ class Bopper extends StageProp implements IPlayStateScriptedClass
if (animOffsets == null) animOffsets = [0, 0];
if ((animOffsets[0] == value[0]) && (animOffsets[1] == value[1])) return value;

var xDiff = animOffsets[0] - value[0];
var yDiff = animOffsets[1] - value[1];
var xDiff = (animOffsets[0] - value[0]) * (!this.isPixel ? this.scale.x : 1);
var yDiff = (animOffsets[1] - value[1]) * (!this.isPixel ? this.scale.y : 1);

this.x += xDiff;
this.y += yDiff;
Expand Down

0 comments on commit 7daf6ab

Please sign in to comment.