1
0
Fork 0
mirror of https://github.com/ninjamuffin99/Funkin.git synced 2025-07-21 20:01:07 +00:00

Add the "death.cameraOffset" attribute to character data

This commit is contained in:
EliteMasterEric 2023-10-11 01:04:56 -04:00
parent 3228b86d07
commit 7a9b4d6bf0
4 changed files with 24 additions and 2 deletions

2
assets

@ -1 +1 @@
Subproject commit 6e5ed46026a2eb1e575c5accf9192b90c13ff857
Subproject commit c1ef5f68303b8069702193078c8228ffc9dc551e

View file

@ -103,6 +103,9 @@ class GameOverSubState extends MusicBeatSubState
cameraFollowPoint = new FlxObject(PlayState.instance.cameraFollowPoint.x, PlayState.instance.cameraFollowPoint.y, 1, 1);
cameraFollowPoint.x = boyfriend.getGraphicMidpoint().x;
cameraFollowPoint.y = boyfriend.getGraphicMidpoint().y;
var offsets:Array<Float> = boyfriend.getDeathCameraOffsets();
cameraFollowPoint.x += offsets[0];
cameraFollowPoint.y += offsets[1];
add(cameraFollowPoint);
FlxG.camera.target = null;

View file

@ -188,6 +188,11 @@ class BaseCharacter extends Bopper
shouldBop = false;
}
public function getDeathCameraOffsets():Array<Float>
{
return _data.death?.cameraOffsets ?? [0.0, 0.0];
}
/**
* Gets the value of flipX from the character data.
* `!getFlipX()` is the direction Boyfriend should face.

View file

@ -19,8 +19,10 @@ class CharacterDataParser
* The current version string for the stage data format.
* Handle breaking changes by incrementing this value
* and adding migration to the `migrateStageData()` function.
*
* - Version 1.0.1 adds `death.cameraOffsets`
*/
public static final CHARACTER_DATA_VERSION:String = '1.0.0';
public static final CHARACTER_DATA_VERSION:String = '1.0.1';
/**
* The current version rule check for the stage data format.
@ -603,6 +605,8 @@ typedef CharacterData =
*/
var healthIcon:Null<HealthIconData>;
var death:Null<DeathData>;
/**
* The global offset to the character's position, in pixels.
* @default [0, 0]
@ -695,3 +699,13 @@ typedef HealthIconData =
*/
var offsets:Null<Array<Float>>;
}
typedef DeathData =
{
/**
* The amount to offset the camera by while focusing on this character as they die.
* Default value focuses on the character's graphic midpoint.
* @default [0, 0]
*/
var ?cameraOffsets:Array<Float>;
}