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

FlxCamera.stopFade, stopFlash, and stopShake #3063

Merged
merged 5 commits into from
Mar 7, 2024
Merged
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
34 changes: 31 additions & 3 deletions flixel/FlxCamera.hx
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@ import openfl.Vector;
import openfl.display.BlendMode;
import openfl.filters.BitmapFilter;

using StringTools;

using flixel.util.FlxColorTransformUtil;

private typedef FlxDrawItem = flixel.graphics.tile.FlxDrawQuadsItem;
Expand Down Expand Up @@ -1601,15 +1603,41 @@ class FlxCamera extends FlxBasic
}

/**
* Just turns off all the camera effects instantly.
* Stops the fade effect on `this` camera.
*/
public function stopFX():Void
public function stopFade():Void
{
_fxFlashAlpha = 0.0;
_fxFadeAlpha = 0.0;
_fxFadeDuration = 0.0;
}

/**
* Stops the flash effect on `this` camera.
*/
public function stopFlash():Void
{
_fxFlashAlpha = 0.0;
updateFlashSpritePosition();
}

/**
* Stops the shake effect on `this` camera.
*/
public function stopShake():Void
{
_fxShakeDuration = 0.0;
}

/**
* Stops all effects on `this` camera.
*/
public function stopFX():Void
{
_fxFadeAlpha = 0.0;
_fxFadeDuration = 0.0;
_fxFlashAlpha = 0.0;
updateFlashSpritePosition();
_fxShakeDuration = 0.0;
}

/**
Expand Down
Loading