From 422f556b7c24f5a444da09cdc614c26686884eb5 Mon Sep 17 00:00:00 2001 From: Hoovy <124418090+MemeHovy@users.noreply.github.com> Date: Thu, 6 Jul 2023 04:46:02 -0400 Subject: [PATCH] Make offset points get put in the pool when FunkinSprite is destroyed (#178) * make points get put in the pool Co-Authored-By: Sword352 <99792114+Sword352@users.noreply.github.com> * I forgot this * null check --------- Co-authored-by: Sword352 <99792114+Sword352@users.noreply.github.com> --- source/funkin/backend/FunkinSprite.hx | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/source/funkin/backend/FunkinSprite.hx b/source/funkin/backend/FunkinSprite.hx index fdd897ee..15d7d10c 100644 --- a/source/funkin/backend/FunkinSprite.hx +++ b/source/funkin/backend/FunkinSprite.hx @@ -209,6 +209,15 @@ class FunkinSprite extends FlxSkewedSprite implements IBeatReceiver implements I public override function destroy() { animateAtlas = FlxDestroyUtil.destroy(animateAtlas); + + if (animOffsets != null){ + for (key in animOffsets.keys()) { + final point = animOffsets[key]; + animOffsets.remove(key); + point.put(); + } + animOffsets = null; + } super.destroy(); } #end @@ -248,7 +257,7 @@ class FunkinSprite extends FlxSkewedSprite implements IBeatReceiver implements I public function addOffset(name:String, x:Float = 0, y:Float = 0) { - animOffsets[name] = new FlxPoint(x, y); + animOffsets[name] = FlxPoint.get(x, y); } public function switchOffset(anim1:String, anim2:String)