Add Camera Zoom Event not unzooming #587
-
In my song, the Add Camera Zoom event does something weird. Friday.Night.Funkin.-.Codename.Engine.Chart.Editor.2025-03-22.21-13-23.mp4For whatever reason, the Add Camera Zoom event seems to permanently zoom in by the amount inputted in the event. I thought it had something to do with a zoom event which I made, but upon removing every event in the level, the same thing happened. I'm at a loss and I can't find out why this would be happening. Event JSON: {
"params": [
{
"name": "Camera Focus Position (formatted as \"X,Y\")",
"type": "String",
"defaultValue": "0,0"
},
{
"name": "Zoom Amount",
"type": "Float(0, 3, 1, 3)",
"defaultValue": 1.000
},
{
"name": "Tween Duration",
"type": "Float(0, 9999, 1, 2)",
"defaultValue": 1.00
},
{
"name": "Tween Ease",
"type": "DropDown('back', 'bounce', 'circ', 'cube', 'elastic', 'expo', 'linear', 'quad', 'quart', 'quint', 'sine', 'smoothStep', 'smootherStep')",
"defaultValue": "linear"
},
{
"name": "Tween Ease Direction",
"type": "DropDown('In', 'Out', 'InOut')",
"defaultValue": "InOut"
},
{
"name": "Reset Cam Zoom and Position?",
"type": "Bool",
"defaultValue": false
}
]
} Event Code: //
var camMove_event:FlxPoint;
function postCreate() {
camMove_event = null;
}
function onEvent(event:EventGameEvent) {
if (event.event.name == "Zoom Event") {
var params = event.event.params;
var pos:String = params[0];
var zAmt:Float = params[1];
var dur:Float = params[2];
var tEase:String = params[3];
var tDir:String = params[4];
var reset:Bool = params[5];
var posArray:Array<String> = pos.split(",");
changeZoomFactor(Std.parseFloat(posArray[0]), Std.parseFloat(posArray[1]), zAmt, dur, (tEase != "linear") ? tEase + tDir : tEase, reset);
}
}
function changeZoomFactor(camFocusX:Float, camFocusY:Float, zoom:Float, duration:Float, tweenEase:String, resetZoomAndPos:Bool) {
var ogZoom:Float = defaultCamZoom;
if (resetZoomAndPos) {
camMove_event = null;
if (duration != 0) {
FlxTween.num(ogZoom, Std.parseFloat(stage.stageXML.get("zoom")), duration, { ease: Reflect.field(FlxEase, tweenEase) }, function(val:Float) {
defaultCamZoom = val;
camGame.zoom = val;
});
} else {
defaultCamZoom = Std.parseFloat(stage.stageXML.get("zoom"));
camGame.zoom = zoom;
}
} else {
camMove_event = FlxPoint.get(camFocusX, camFocusY);
if (duration != 0) {
FlxTween.num(ogZoom, zoom, duration, { ease: Reflect.field(FlxEase, tweenEase) }, function(val:Float) {
defaultCamZoom = val;
camGame.zoom = val;
});
} else {
defaultCamZoom = zoom;
camGame.zoom = zoom;
}
}
}
function onCameraMove(event:CamMoveEvent) {
if (camMove_event != null) {
event.position.x = camMove_event.x;
event.position.y = camMove_event.y;
}
} |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 3 replies
-
yeah, believe it or not, for some reason it only unzooms when there are notes to hit. also welcome back microkat. |
Beta Was this translation helpful? Give feedback.
-
thats something made on purpose because thats how base fnf works like (even psych and other engines have this feature) function postCreate()
camZooming = true;
|
Beta Was this translation helpful? Give feedback.
thats something made on purpose because thats how base fnf works like (even psych and other engines have this feature)
to disable this just do
camZooming
automatically becomestrue
when a character hits a note, its also a variable in the NoteHit event