X Tutup
Skip to content

Commit 61c710f

Browse files
committed
some fixes and goodness
1 parent 0fd6f5b commit 61c710f

File tree

1 file changed

+18
-9
lines changed

1 file changed

+18
-9
lines changed

source/funkin/ui/debug/anim/DebugBoundingState.hx

Lines changed: 18 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -171,6 +171,21 @@ class DebugBoundingState extends FlxState
171171
}
172172
}
173173

174+
function updateOnionSkin():Void
175+
{
176+
if (swagChar == null) return;
177+
if (swagChar.hasAnimation("idle")) swagChar.playAnimation("idle", true);
178+
179+
onionSkinChar.loadGraphicFromSprite(swagChar);
180+
onionSkinChar.frame = swagChar.frame;
181+
onionSkinChar.alpha = 0.6;
182+
onionSkinChar.flipX = swagChar.flipX;
183+
onionSkinChar.offset.x = swagChar.animOffsets[0];
184+
onionSkinChar.offset.y = swagChar.animOffsets[1];
185+
186+
swagChar.playAnimation(currentAnimationName, true); // reset animation to the one it should be
187+
}
188+
174189
function initOffsetView():Void
175190
{
176191
offsetView = new FlxGroup();
@@ -395,11 +410,13 @@ class DebugBoundingState extends FlxState
395410
if (FlxG.keys.justPressed.F)
396411
{
397412
onionSkinChar.visible = !onionSkinChar.visible;
413+
if (onionSkinChar.visible) updateOnionSkin();
398414
}
399415

400416
if (FlxG.keys.justPressed.G)
401417
{
402418
swagChar.flipX = !swagChar.flipX;
419+
if (onionSkinChar.visible) updateOnionSkin();
403420
}
404421

405422
// Plays the idle animation
@@ -545,15 +562,7 @@ class DebugBoundingState extends FlxState
545562

546563
function playCharacterAnimation(str:String, setOnionSkin:Bool = true)
547564
{
548-
if (setOnionSkin)
549-
{
550-
onionSkinChar.loadGraphicFromSprite(swagChar);
551-
onionSkinChar.frame = swagChar.frame;
552-
onionSkinChar.alpha = 0.6;
553-
onionSkinChar.flipX = swagChar.flipX;
554-
onionSkinChar.offset.x = swagChar.animOffsets[0];
555-
onionSkinChar.offset.y = swagChar.animOffsets[1];
556-
}
565+
if (setOnionSkin) updateOnionSkin();
557566

558567
// var animName = characterAnimNames[Std.parseInt(str)];
559568
var animName = str;

0 commit comments

Comments
 (0)
X Tutup