From 2760a9ae9a95485cd981ea196b8824b82af4670e Mon Sep 17 00:00:00 2001 From: Eric Myllyoja Date: Sun, 24 Jul 2022 14:44:17 -0400 Subject: [PATCH] Polished Week 4 light post code. --- source/funkin/play/stage/Stage.hx | 2 ++ source/funkin/play/stage/StageData.hx | 12 ++++++++++++ 2 files changed, 14 insertions(+) diff --git a/source/funkin/play/stage/Stage.hx b/source/funkin/play/stage/Stage.hx index de693e9c5..3f3debc63 100644 --- a/source/funkin/play/stage/Stage.hx +++ b/source/funkin/play/stage/Stage.hx @@ -174,6 +174,8 @@ class Stage extends FlxSpriteGroup implements IHook implements IPlayStateScripte propSprite.x = dataProp.position[0]; propSprite.y = dataProp.position[1]; + propSprite.alpha = dataProp.alpha; + // If pixel, disable antialiasing. propSprite.antialiasing = !dataProp.isPixel; diff --git a/source/funkin/play/stage/StageData.hx b/source/funkin/play/stage/StageData.hx index e42eba5a3..5694ac3a1 100644 --- a/source/funkin/play/stage/StageData.hx +++ b/source/funkin/play/stage/StageData.hx @@ -181,6 +181,7 @@ class StageDataParser static final DEFAULT_CAMERA_OFFSETS_DAD:Array = [150, -100]; static final DEFAULT_POSITION:Array = [0, 0]; static final DEFAULT_SCALE:Float = 1.0; + static final DEFAULT_ALPHA:Float = 1.0; static final DEFAULT_SCROLL:Array = [0, 0]; static final DEFAULT_ZINDEX:Int = 0; @@ -283,6 +284,11 @@ class StageDataParser inputProp.scroll = DEFAULT_SCROLL; } + if (inputProp.alpha == null) + { + inputProp.alpha = DEFAULT_ALPHA; + } + if (Std.isOfType(inputProp.scroll, Float)) { inputProp.scroll = [inputProp.scroll, inputProp.scroll]; @@ -442,6 +448,12 @@ typedef StageDataProp = */ var scale:OneOfTwo>; + /** + * The alpha of the prop, as a float. + * @default 1.0 + */ + var alpha:Null; + /** * If not zero, this prop will play an animation every X beats of the song. * This requires animations to be defined. If `danceLeft` and `danceRight` are defined,