From 57bdb7c327b7e3dd7aa0ee1598ba4699386f5ddb Mon Sep 17 00:00:00 2001 From: NeeEoo Date: Wed, 9 Aug 2023 02:09:45 +0200 Subject: [PATCH] Trail helpers --- source/funkin/game/Character.hx | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/source/funkin/game/Character.hx b/source/funkin/game/Character.hx index 04a64ff2..e8f32fbd 100644 --- a/source/funkin/game/Character.hx +++ b/source/funkin/game/Character.hx @@ -361,6 +361,36 @@ class Character extends FunkinSprite implements IBeatReceiver implements IOffset globalOffset.put(); } + // FlxTrail Stuff for fixing position + + var __reverseTrailProcedure:Bool = false; + + /** + * When using trails on characters you should do `trail.beforeCache = char.beforeTrailCache;` + **/ + dynamic function beforeTrailCache() { + if (isFlippedOffsets()) + { + flipX = !flipX; + scale.x *= -1; + __reverseTrailProcedure = true; + } + } + + /** + * When using trails on characters you should do `trail.afterCache = char.afterTrailCache;` + **/ + dynamic function afterTrailCache() { + if (__reverseTrailProcedure) + { + flipX = !flipX; + scale.x *= -1; + __reverseTrailProcedure = false; + } + } + + // Character editor and loading + public function applyXML(xml:Access) { this.xml = xml; // modders wassup sprite = curCharacter;