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>
This commit is contained in:
Hoovy
2023-07-06 10:46:02 +02:00
committed by GitHub
co-authored by Sword352
parent 890e3dfa1a
commit 422f556b7c
+10 -1
View File
@@ -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)