mirror of
https://github.com/ninjamuffin99/Funkin.git
synced 2025-11-25 21:55:55 +00:00
did the requested changes
This commit is contained in:
parent
7ce3eabd17
commit
dd86934712
|
|
@ -1,7 +1,6 @@
|
||||||
package funkin.play.character;
|
package funkin.play.character;
|
||||||
|
|
||||||
import flixel.math.FlxPoint;
|
import flixel.math.FlxPoint;
|
||||||
import flixel.FlxCamera;
|
|
||||||
import funkin.modding.events.ScriptEvent;
|
import funkin.modding.events.ScriptEvent;
|
||||||
import funkin.play.character.CharacterData.CharacterDataParser;
|
import funkin.play.character.CharacterData.CharacterDataParser;
|
||||||
import funkin.play.character.CharacterData.CharacterRenderType;
|
import funkin.play.character.CharacterData.CharacterRenderType;
|
||||||
|
|
@ -119,20 +118,6 @@ class BaseCharacter extends Bopper
|
||||||
*/
|
*/
|
||||||
public var cameraFocusPoint(default, null):FlxPoint = new FlxPoint(0, 0);
|
public var cameraFocusPoint(default, null):FlxPoint = new FlxPoint(0, 0);
|
||||||
|
|
||||||
/**
|
|
||||||
* Defines the animation offset.
|
|
||||||
*/
|
|
||||||
public var animOffset:FlxPoint = FlxPoint.get();
|
|
||||||
|
|
||||||
override function set_animOffsets(value:Array<Float>):Array<Float>
|
|
||||||
{
|
|
||||||
if (animOffsets == null) value = [0, 0];
|
|
||||||
if ((animOffsets[0] == value[0]) && (animOffsets[1] == value[1])) return value;
|
|
||||||
|
|
||||||
animOffset.set(value[0], value[1]);
|
|
||||||
return animOffsets = value;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* If the x position changes, other than via changing the animation offset,
|
* If the x position changes, other than via changing the animation offset,
|
||||||
* then we need to update the camera focus point.
|
* then we need to update the camera focus point.
|
||||||
|
|
@ -569,25 +554,11 @@ class BaseCharacter extends Bopper
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// override getScreenPosition (used by FlxSprite's draw method) to account for animation offsets.
|
|
||||||
override function getScreenPosition(?result:FlxPoint, ?camera:FlxCamera):FlxPoint
|
|
||||||
{
|
|
||||||
var output:FlxPoint = super.getScreenPosition(result, camera);
|
|
||||||
output -= animOffset;
|
|
||||||
return output;
|
|
||||||
}
|
|
||||||
|
|
||||||
public override function onDestroy(event:ScriptEvent):Void
|
public override function onDestroy(event:ScriptEvent):Void
|
||||||
{
|
{
|
||||||
this.characterType = OTHER;
|
this.characterType = OTHER;
|
||||||
}
|
}
|
||||||
|
|
||||||
override function destroy():Void
|
|
||||||
{
|
|
||||||
animOffset = flixel.util.FlxDestroyUtil.put(animOffset);
|
|
||||||
super.destroy();
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Play the appropriate singing animation, for the given note direction.
|
* Play the appropriate singing animation, for the given note direction.
|
||||||
* @param dir The direction of the note.
|
* @param dir The direction of the note.
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,7 @@
|
||||||
package funkin.play.stage;
|
package funkin.play.stage;
|
||||||
|
|
||||||
import flixel.FlxSprite;
|
import flixel.FlxSprite;
|
||||||
|
import flixel.FlxCamera;
|
||||||
import flixel.math.FlxPoint;
|
import flixel.math.FlxPoint;
|
||||||
import flixel.util.FlxTimer;
|
import flixel.util.FlxTimer;
|
||||||
import funkin.modding.IScriptedClass.IPlayStateScriptedClass;
|
import funkin.modding.IScriptedClass.IPlayStateScriptedClass;
|
||||||
|
|
@ -67,6 +68,11 @@ 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.
|
||||||
*/
|
*/
|
||||||
|
|
@ -95,12 +101,7 @@ 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;
|
||||||
|
|
||||||
var xDiff = animOffsets[0] - value[0];
|
_currentAnimOffset.set(value[0], value[1]);
|
||||||
var yDiff = animOffsets[1] - value[1];
|
|
||||||
|
|
||||||
this.x += xDiff;
|
|
||||||
this.y += yDiff;
|
|
||||||
|
|
||||||
return animOffsets = value;
|
return animOffsets = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -349,6 +350,20 @@ class Bopper extends StageProp implements IPlayStateScriptedClass
|
||||||
return this.animation.curAnim.name;
|
return this.animation.curAnim.name;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// override getScreenPosition (used by FlxSprite's draw method) to account for animation offsets.
|
||||||
|
override function getScreenPosition(?result:FlxPoint, ?camera:FlxCamera):FlxPoint
|
||||||
|
{
|
||||||
|
var output:FlxPoint = super.getScreenPosition(result, camera);
|
||||||
|
output -= _currentAnimOffset;
|
||||||
|
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) {}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue