Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Target Zoom for Cameras in PlayState #15775

Open
wants to merge 13 commits into
base: main
Choose a base branch
from

Conversation

AlsoGhostglowDev
Copy link

@AlsoGhostglowDev AlsoGhostglowDev commented Oct 21, 2024

cameras in playstate now uses PsychCamera which now has the targetZoom field that can be used to manipulate default camera zooms for the hud camera and game camera (defaultCamZoom still works for camGame) but this is mostly done to add the "defaultCamZoom" logic to other cameras.

@AlsoGhostglowDev
Copy link
Author

im thinking of doing smth like this

public var lerpZoom:Bool = true;
public var zoomDecay:Float = 1;

override function update(elapsed:Float) {
    super.update(elapsed);

    zoom = FlxMath.lerp(targetZoom, zoom, Math.exp(-elapsed * 3.125 * zoomDecay * (FlxG.state is PlayState ? PlayState.instance.playbackRate : 1)));
}

in PsychCamera.hx but im not sure whether thats a good thing to add or not

Copy link

@2JENO 2JENO left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

cmd saying:

return camGame.targetZoom = defaultCamZoom = value;
_________________________________ ^^^^^^^^^^^^__________
| This field cannot be accessed because it is not a real variable
public var defaultCamZoom(get, set):Float;
^^^^^^^^^^^^^^^^^^^^^^^^^^^
| Add @:isVar here to enable it

@2JENO
Copy link

2JENO commented Nov 23, 2024

add "@:isVar" over "public var defaultCamZoom(get, set):Float;"

@2JENO
Copy link

2JENO commented Nov 23, 2024

Called from states.PlayState::set_camZoomingDecay states/PlayState.hx line 165
Critical Error: Uncatchable Throw: Null Object Reference

@AlsoGhostglowDev
Copy link
Author

@2JENO yo, didnt see this comment. Sorry for the late response. I'll get into this when I'm return home 👻

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants