From 769969898ba7dea4bea1a334b123053d189acd2e Mon Sep 17 00:00:00 2001 From: Cameron Taylor Date: Sun, 1 May 2022 15:20:15 -0400 Subject: [PATCH] camera positioning fixes --- source/funkin/play/PlayState.hx | 30 +++++++++++++++++++ .../ui/stageBuildShit/StageOffsetSubstate.hx | 7 +++-- 2 files changed, 35 insertions(+), 2 deletions(-) diff --git a/source/funkin/play/PlayState.hx b/source/funkin/play/PlayState.hx index b16d9f00a..8c0dddff6 100644 --- a/source/funkin/play/PlayState.hx +++ b/source/funkin/play/PlayState.hx @@ -1490,6 +1490,10 @@ class PlayState extends MusicBeatState implements IHook if (currentStage == null) return; + // HARDCODED +150, CHANGE LATER??? + var camPosOffsetDad:Float = 150; + var camPosOffsetBF:Float = -100; + var isFocusedOnDad = cameraFollowPoint.x == currentStage.getDad().cameraFocusPoint.x; var isFocusedOnBF = cameraFollowPoint.x == currentStage.getBoyfriend().cameraFocusPoint.x; @@ -1498,6 +1502,20 @@ class PlayState extends MusicBeatState implements IHook // Focus the camera on the player. cameraFollowPoint.setPosition(currentStage.getBoyfriend().cameraFocusPoint.x, currentStage.getBoyfriend().cameraFocusPoint.y); + FlxG.camera.targetOffset.x = camPosOffsetBF; + FlxG.camera.targetOffset.y = camPosOffsetBF; + + switch (currentStageId) + { + case 'limo': + FlxG.camera.targetOffset.x = -300; + case 'mall': + FlxG.camera.targetOffset.y = -200; + case 'school' | 'schoolEvil': + FlxG.camera.targetOffset.x = -200; + FlxG.camera.targetOffset.y = -200; + } + // TODO: Un-hardcode this. if (currentSong.song.toLowerCase() == 'tutorial') FlxTween.tween(FlxG.camera, {zoom: 1 * FlxCamera.defaultZoom}, (Conductor.stepCrochet * 4 / 1000), {ease: FlxEase.elasticInOut}); @@ -1507,9 +1525,21 @@ class PlayState extends MusicBeatState implements IHook // Focus the camera on the opponent. cameraFollowPoint.setPosition(currentStage.getDad().cameraFocusPoint.x, currentStage.getDad().cameraFocusPoint.y); + FlxG.camera.targetOffset.x = camPosOffsetDad; + // TODO: Un-hardcode this stuff. if (currentStage.getDad().characterId == 'mom') + { vocals.volume = 1; + FlxG.camera.targetOffset.x = 0; + } + + if (currentStage.getDad().characterId == "senpai" || currentStage.getDad().characterId == 'senpai-angry') + { + FlxG.camera.targetOffset.y = -430; + FlxG.camera.targetOffset.x = 100; + } + if (currentSong.song.toLowerCase() == 'tutorial') tweenCamIn(); } diff --git a/source/funkin/ui/stageBuildShit/StageOffsetSubstate.hx b/source/funkin/ui/stageBuildShit/StageOffsetSubstate.hx index 11e1463e5..1196e8cf1 100644 --- a/source/funkin/ui/stageBuildShit/StageOffsetSubstate.hx +++ b/source/funkin/ui/stageBuildShit/StageOffsetSubstate.hx @@ -76,8 +76,11 @@ class StageOffsetSubstate extends MusicBeatSubstate char = cast thing; } - sprOld.x = char.x; - sprOld.y = char.y; + if (char != null) + { + sprOld.x = char.x; + sprOld.y = char.y; + } mosPosOld.x = FlxG.mouse.x; mosPosOld.y = FlxG.mouse.y;