1
0
Fork 0
mirror of https://github.com/ninjamuffin99/Funkin.git synced 2024-11-04 13:54:22 +00:00

Added cornerPosition and feetPosition properties for easy reference

This commit is contained in:
Eric Myllyoja 2022-04-29 23:51:52 -04:00
parent 282e93e1ff
commit 5bb1376459

View file

@ -2,11 +2,8 @@ package funkin.play.character;
import flixel.math.FlxPoint;
import funkin.Note.NoteDir;
import funkin.modding.events.ScriptEvent.NoteScriptEvent;
import funkin.modding.events.ScriptEvent.UpdateScriptEvent;
import funkin.modding.events.ScriptEvent;
import funkin.play.character.CharacterData.CharacterDataParser;
import funkin.play.character.CharacterData.CharacterDataParser;
import funkin.play.stage.Bopper;
using StringTools;
@ -41,8 +38,8 @@ class BaseCharacter extends Bopper
final singTimeCrochet:Float;
/**
* Character position in stage file is at the bottom center of the character.
* Position from stage file - character origin is at the top left corner of the character.
* The offset between the corner of the sprite and the origin of the sprite (at the character's feet).
* cornerPosition = stageData - characterOrigin
*/
public var characterOrigin(get, null):FlxPoint;
@ -53,6 +50,27 @@ class BaseCharacter extends Bopper
return new FlxPoint(xPos, yPos);
}
/**
* The absolute position of the top-left of the character.
* @return
*/
public var cornerPosition(get, null):FlxPoint;
function get_cornerPosition():FlxPoint
{
return new FlxPoint(x, y);
}
/**
* The absolute position of the character's feet, at the bottom-center of the sprite.
*/
public var feetPosition(get, null):FlxPoint;
function get_feetPosition():FlxPoint
{
return new FlxPoint(x + characterOrigin.x, y + characterOrigin.y);
}
/**
* Returns the point the camera should focus on.
* Should be approximately centered on the character, and should not move based on the current animation.