Use animOffsets directly.

This commit is contained in:
Sword352 2024-05-08 22:18:41 +02:00
parent dd86934712
commit f6334fb30b

View file

@ -68,11 +68,6 @@ class Bopper extends StageProp implements IPlayStateScriptedClass
return value; return value;
} }
/**
* Internally used to define the animation offsets to apply.
*/
var _currentAnimOffset:FlxPoint = FlxPoint.get();
/** /**
* The offset of the character relative to the position specified by the stage. * The offset of the character relative to the position specified by the stage.
*/ */
@ -101,7 +96,6 @@ class Bopper extends StageProp implements IPlayStateScriptedClass
if (animOffsets == null) animOffsets = [0, 0]; if (animOffsets == null) animOffsets = [0, 0];
if ((animOffsets[0] == value[0]) && (animOffsets[1] == value[1])) return value; if ((animOffsets[0] == value[0]) && (animOffsets[1] == value[1])) return value;
_currentAnimOffset.set(value[0], value[1]);
return animOffsets = value; return animOffsets = value;
} }
@ -354,16 +348,11 @@ class Bopper extends StageProp implements IPlayStateScriptedClass
override function getScreenPosition(?result:FlxPoint, ?camera:FlxCamera):FlxPoint override function getScreenPosition(?result:FlxPoint, ?camera:FlxCamera):FlxPoint
{ {
var output:FlxPoint = super.getScreenPosition(result, camera); var output:FlxPoint = super.getScreenPosition(result, camera);
output -= _currentAnimOffset; output.x -= animOffsets[0];
output.y -= animOffsets[1];
return output; return output;
} }
override function destroy():Void
{
_currentAnimOffset = flixel.util.FlxDestroyUtil.put(_currentAnimOffset);
super.destroy();
}
public function onPause(event:PauseScriptEvent) {} public function onPause(event:PauseScriptEvent) {}
public function onResume(event:ScriptEvent) {} public function onResume(event:ScriptEvent) {}