1
0
Fork 0
mirror of https://github.com/ninjamuffin99/Funkin.git synced 2024-11-25 08:13:45 +00:00

cameraOffset stuff defaulted properly

This commit is contained in:
Cameron Taylor 2022-05-03 14:07:18 -04:00
parent d835bed813
commit f37c2cbbf6
2 changed files with 13 additions and 29 deletions

View file

@ -1502,10 +1502,6 @@ class PlayState extends MusicBeatState implements IHook
if (currentStage == null)
return;
// HARDCODED +150, CHANGE LATER???
var camPosOffsetDad:FlxPoint = FlxPoint.get(150, -100);
var camPosOffsetBF:Float = -100;
var isFocusedOnDad = cameraFollowPoint.x == currentStage.getDad().cameraFocusPoint.x;
var isFocusedOnBF = cameraFollowPoint.x == currentStage.getBoyfriend().cameraFocusPoint.x;
@ -1514,21 +1510,6 @@ class PlayState extends MusicBeatState implements IHook
// Focus the camera on the player.
cameraFollowPoint.setPosition(currentStage.getBoyfriend().cameraFocusPoint.x, currentStage.getBoyfriend().cameraFocusPoint.y);
// ALSO UNHARDCODE THIS CAMERA BULLSHIT TOO
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 = 0;
}
// TODO: Un-hardcode this.
if (currentSong.song.toLowerCase() == 'tutorial')
FlxTween.tween(FlxG.camera, {zoom: 1 * FlxCamera.defaultZoom}, (Conductor.stepCrochet * 4 / 1000), {ease: FlxEase.elasticInOut});
@ -1538,18 +1519,10 @@ 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.set(camPosOffsetDad.x, camPosOffsetDad.y);
// TODO: Un-hardcode this stuff.
if (currentStage.getDad().characterId == 'mom')
{
vocals.volume = 1;
FlxG.camera.targetOffset.y = 0;
}
if (currentStage.getDad().characterId == "senpai" || currentStage.getDad().characterId == 'senpai-angry')
{
FlxG.camera.targetOffset.y = -30;
}
if (currentSong.song.toLowerCase() == 'tutorial')

View file

@ -175,6 +175,8 @@ class StageDataParser
static final DEFAULT_ISPIXEL:Bool = false;
static final DEFAULT_NAME:String = "Untitled Stage";
static final DEFAULT_OFFSETS:Array<Float> = [0, 0];
static final DEFAULT_CAMERA_OFFSETS_BF:Array<Float> = [-100, -100];
static final DEFAULT_CAMERA_OFFSETS_DAD:Array<Float> = [150, -100];
static final DEFAULT_POSITION:Array<Float> = [0, 0];
static final DEFAULT_SCALE:Float = 1.0;
static final DEFAULT_SCROLL:Array<Float> = [0, 0];
@ -339,10 +341,12 @@ class StageDataParser
if (input.characters.bf == null)
{
input.characters.bf = DEFAULT_CHARACTER_DATA;
input.characters.bf.cameraOffsets = DEFAULT_CAMERA_OFFSETS_BF;
}
if (input.characters.dad == null)
{
input.characters.dad = DEFAULT_CHARACTER_DATA;
input.characters.dad.cameraOffsets = DEFAULT_CAMERA_OFFSETS_DAD;
}
if (input.characters.gf == null)
{
@ -361,7 +365,14 @@ class StageDataParser
}
if (inputCharacter.cameraOffsets == null || inputCharacter.cameraOffsets.length != 2)
{
inputCharacter.cameraOffsets = [0, 0];
if (inputCharacter == input.characters.bf)
inputCharacter.cameraOffsets = DEFAULT_CAMERA_OFFSETS_BF;
if (inputCharacter == input.characters.dad)
inputCharacter.cameraOffsets = DEFAULT_CAMERA_OFFSETS_DAD;
else
{
inputCharacter.cameraOffsets = [0, 0];
}
}
}
@ -484,7 +495,7 @@ typedef StageDataCharacter =
/**
* The camera offsets to apply when focusing on the character on this stage.
* @default [0, 0]
* @default [-100, -100] for BF, [100, -100] for DAD/OPPONENT, [0, 0] for GF
*/
cameraOffsets:Array<Float>,
};