Merge pull request #413 from ActualMandM/kade-flash

improve flashing lights option
This commit is contained in:
Kade M 2021-05-10 01:36:24 -07:00 committed by GitHub
commit 45355e2c56
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 42 additions and 27 deletions

View File

@ -11,6 +11,7 @@ import flixel.text.FlxText;
import flixel.tweens.FlxEase; import flixel.tweens.FlxEase;
import flixel.tweens.FlxTween; import flixel.tweens.FlxTween;
import flixel.util.FlxColor; import flixel.util.FlxColor;
import flixel.util.FlxTimer;
import io.newgrounds.NG; import io.newgrounds.NG;
import lime.app.Application; import lime.app.Application;
@ -164,9 +165,8 @@ class MainMenuState extends MusicBeatState
selectedSomethin = true; selectedSomethin = true;
FlxG.sound.play(Paths.sound('confirmMenu')); FlxG.sound.play(Paths.sound('confirmMenu'));
if(FlxG.save.data.flashing){ if (FlxG.save.data.flashing)
FlxFlicker.flicker(magenta, 1.1, 0.15, false); FlxFlicker.flicker(magenta, 1.1, 0.15, false);
}
menuItems.forEach(function(spr:FlxSprite) menuItems.forEach(function(spr:FlxSprite)
{ {
@ -181,8 +181,36 @@ class MainMenuState extends MusicBeatState
}); });
} }
else else
{
if (FlxG.save.data.flashing)
{ {
FlxFlicker.flicker(spr, 1, 0.06, false, false, function(flick:FlxFlicker) FlxFlicker.flicker(spr, 1, 0.06, false, false, function(flick:FlxFlicker)
{
goToState();
});
}
else
{
new FlxTimer().start(1, function(tmr:FlxTimer)
{
goToState();
});
}
}
});
}
}
}
super.update(elapsed);
menuItems.forEach(function(spr:FlxSprite)
{
spr.screenCenter(X);
});
}
function goToState()
{ {
var daChoice:String = optionShit[curSelected]; var daChoice:String = optionShit[curSelected];
@ -199,19 +227,6 @@ class MainMenuState extends MusicBeatState
case 'options': case 'options':
FlxG.switchState(new OptionsMenu()); FlxG.switchState(new OptionsMenu());
} }
});
}
});
}
}
}
super.update(elapsed);
menuItems.forEach(function(spr:FlxSprite)
{
spr.screenCenter(X);
});
} }
function changeItem(huh:Int = 0) function changeItem(huh:Int = 0)

View File

@ -37,14 +37,13 @@ class MenuItem extends FlxSpriteGroup
{ {
super.update(elapsed); super.update(elapsed);
y = FlxMath.lerp(y, (targetY * 120) + 480, 0.17 * (60 / FlxG.save.data.fpsCap)); y = FlxMath.lerp(y, (targetY * 120) + 480, 0.17 * (60 / FlxG.save.data.fpsCap));
if(FlxG.save.data.flashing){
if (isFlashing) if (isFlashing)
flashingInt += 1; flashingInt += 1;
if (flashingInt % fakeFramerate >= Math.floor(fakeFramerate / 2)) if (flashingInt % fakeFramerate >= Math.floor(fakeFramerate / 2))
week.color = 0xFF33ffff; week.color = 0xFF33ffff;
else else if (FlxG.save.data.flashing)
week.color = FlxColor.WHITE; week.color = FlxColor.WHITE;
} }
} }
}

View File

@ -295,6 +295,7 @@ class TitleState extends MusicBeatState
NGio.unlockMedal(61034); NGio.unlockMedal(61034);
#end #end
if (FlxG.save.data.flashing)
titleText.animation.play('press'); titleText.animation.play('press');
FlxG.camera.flash(FlxColor.WHITE, 1); FlxG.camera.flash(FlxColor.WHITE, 1);