Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion source/funkin/backend/chart/EventsData.hx
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,9 @@ class EventsData {
type: TDropDown(['In', 'Out', 'InOut']),
defValue: "In",
saveIfDefault: false
}
},
{name: "Offset X", type: TFloat(null, null, 10, 3), defValue: 0},
{name: "Offset Y", type: TFloat(null, null, 10, 3), defValue: 0},
],
"Camera Position" => [
{name: "X", type: TFloat(null, null, 10, 3), defValue: 0},
Expand Down
15 changes: 15 additions & 0 deletions source/funkin/game/PlayState.hx
Original file line number Diff line number Diff line change
Expand Up @@ -193,6 +193,12 @@ class PlayState extends MusicBeatState
*/
public var camFollow:FlxObject;

/**
* Point defining the camera follow offset.
* Used for the "Camera Movement" event.
*/
public var cameraFocusOffset:FlxPoint;

/**
* Previous cam follow.
*/
Expand Down Expand Up @@ -712,6 +718,8 @@ class PlayState extends MusicBeatState
camFollow = new FlxObject(0, 0, 2, 2);
add(camFollow);

cameraFocusOffset = FlxPoint.get();

if (SONG.stage == null || SONG.stage.trim() == "") SONG.stage = Flags.DEFAULT_STAGE;
add(stage = new Stage(SONG.stage));

Expand Down Expand Up @@ -1094,6 +1102,8 @@ class PlayState extends MusicBeatState
remove(stage, true);
}

cameraFocusOffset.put();

scripts = FlxDestroyUtil.destroy(scripts);

super.destroy();
Expand Down Expand Up @@ -1481,6 +1491,8 @@ class PlayState extends MusicBeatState

public function moveCamera() if (strumLines.members[curCameraTarget] != null) {
var data:CamPosData = getStrumlineCamPos(curCameraTarget);
data.pos.add(cameraFocusOffset.x, cameraFocusOffset.y);

if (data.amount > 0) {
var event = gameAndCharsEvent("onCameraMove", EventManager.get(CamMoveEvent).recycle(data.pos, strumLines.members[curCameraTarget], data.amount));
if (!event.cancelled)
Expand Down Expand Up @@ -1564,6 +1576,9 @@ class PlayState extends MusicBeatState
}

curCameraTarget = event.params[0];

cameraFocusOffset.set(event.params[5], event.params[6]);

moveCamera();

if (strumLines.members[curCameraTarget] != null) {
Expand Down