use character's camera focus point to determine the game over cam position

This commit is contained in:
Kolo
2026-01-29 22:07:58 -07:00
committed by Hundrec
parent 00f28fdb79
commit 95109daedb
+13 -18
View File
@@ -168,7 +168,7 @@ class GameOverSubState extends MusicBeatSubState
boyfriend.canPlayOtherAnims = true;
boyfriend.isDead = true;
add(boyfriend);
boyfriend.resetCharacter();
boyfriend.resetCharacter(false);
}
}
@@ -199,8 +199,18 @@ class GameOverSubState extends MusicBeatSubState
// Assign a camera follow point to the boyfriend's position.
cameraFollowPoint = new FlxObject(parentPlayState.cameraFollowPoint.x, parentPlayState.cameraFollowPoint.y, 1, 1);
cameraFollowPoint.x = getMidPointOld(boyfriend).x;
cameraFollowPoint.y = getMidPointOld(boyfriend).y;
cameraFollowPoint.x = boyfriend.cameraFocusPoint.x;
cameraFollowPoint.y = boyfriend.cameraFocusPoint.y;
@:privateAccess
{
cameraFollowPoint.x -= Std.int(boyfriend._data.cameraOffsets[0]);
cameraFollowPoint.y -= Std.int(boyfriend._data.cameraOffsets[1]);
cameraFollowPoint.x -= Std.int((parentPlayState?.currentStage?._data?.characters?.bf?.cameraOffsets ?? [0, 0])[0]);
cameraFollowPoint.y -= Std.int((parentPlayState?.currentStage?._data?.characters?.bf?.cameraOffsets ?? [0, 0])[1]);
}
var offsets:Array<Float> = boyfriend.getDeathCameraOffsets();
cameraFollowPoint.x += offsets[0];
cameraFollowPoint.y += offsets[1];
@@ -212,21 +222,6 @@ class GameOverSubState extends MusicBeatSubState
targetCameraZoom = (parentPlayState?.currentStage?.camZoom ?? 1.0) * boyfriend.getDeathCameraZoom();
}
/**
* FlxSprite.getMidpoint(); calculations changed in this git commit
* https://github.com/HaxeFlixel/flixel/commit/1553b5af0871462fcefedc091b7885437d6c36d2
* https://github.com/HaxeFlixel/flixel/pull/3125
*
* So we use this to do the old math that gets the midpoint of our graphics
* Luckily, we don't use getGraphicMidpoint() much in the code, so it's fine being in GameoverSubState here.
* @return FlxPoint
*/
function getMidPointOld(spr:FlxSprite, ?point:FlxPoint):FlxPoint
{
if (point == null) point = FlxPoint.get();
return point.set(spr.x + spr.frameWidth * 0.5 * spr.scale.x, spr.y + spr.frameHeight * 0.5 * spr.scale.y);
}
/**
* Forcibly reset the camera zoom level to that of the current stage.
* This prevents camera zoom events from adversely affecting the game over state.