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)
{ {
@ -182,24 +182,20 @@ class MainMenuState extends MusicBeatState
} }
else else
{ {
FlxFlicker.flicker(spr, 1, 0.06, false, false, function(flick:FlxFlicker) if (FlxG.save.data.flashing)
{ {
var daChoice:String = optionShit[curSelected]; FlxFlicker.flicker(spr, 1, 0.06, false, false, function(flick:FlxFlicker)
switch (daChoice)
{ {
case 'story mode': goToState();
FlxG.switchState(new StoryMenuState()); });
trace("Story Menu Selected"); }
case 'freeplay': else
FlxG.switchState(new FreeplayState()); {
new FlxTimer().start(1, function(tmr:FlxTimer)
trace("Freeplay Menu Selected"); {
goToState();
case 'options': });
FlxG.switchState(new OptionsMenu()); }
}
});
} }
}); });
} }
@ -214,6 +210,25 @@ class MainMenuState extends MusicBeatState
}); });
} }
function goToState()
{
var daChoice:String = optionShit[curSelected];
switch (daChoice)
{
case 'story mode':
FlxG.switchState(new StoryMenuState());
trace("Story Menu Selected");
case 'freeplay':
FlxG.switchState(new FreeplayState());
trace("Freeplay Menu Selected");
case 'options':
FlxG.switchState(new OptionsMenu());
}
}
function changeItem(huh:Int = 0) function changeItem(huh:Int = 0)
{ {
curSelected += huh; curSelected += huh;

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)
flashingInt += 1;
if (flashingInt % fakeFramerate >= Math.floor(fakeFramerate / 2)) if (isFlashing)
week.color = 0xFF33ffff; flashingInt += 1;
else
week.color = FlxColor.WHITE; if (flashingInt % fakeFramerate >= Math.floor(fakeFramerate / 2))
} week.color = 0xFF33ffff;
else if (FlxG.save.data.flashing)
week.color = FlxColor.WHITE;
} }
} }

View File

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