Merge pull request #328 from CyndaquilDAC/distractions-toggle

Distractions toggle
This commit is contained in:
Kade M 2021-04-28 10:44:11 -07:00 committed by GitHub
commit 282af5c267
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 161 additions and 94 deletions

View File

@ -182,6 +182,26 @@ class SongPositionOption extends Option
}
}
class DistractionsAndEffectsOption extends Option
{
public function new(desc:String)
{
super();
description = desc;
}
public override function press():Bool
{
FlxG.save.data.distractions = !FlxG.save.data.distractions;
display = updateDisplay();
return true;
}
private override function updateDisplay():String
{
return "Distractions " + (!FlxG.save.data.distractions ? "off" : "on");
}
}
class Judgement extends Option
{
@ -264,6 +284,8 @@ class FPSOption extends Option
}
}
class FPSCapOption extends Option
{
public function new(desc:String)

View File

@ -35,6 +35,7 @@ class OptionsMenu extends MusicBeatState
new OptionCatagory("Appearence", [
new SongPositionOption("Show the songs current position (as a bar)"),
new DownscrollOption("Change the layout of the strumline."),
new DistractionsAndEffectsOption("Toggle stage distractions that can hinder your gameplay."),
#if desktop
new RainbowFPSOption("Make the FPS Counter Rainbow (Only works with the FPS Counter toggeled on)"),
#end

View File

@ -158,7 +158,7 @@ class PlayState extends MusicBeatState
var notesHitArray:Array<Date> = [];
var currentFrames:Int = 0;
var dialogue:Array<String> = ['blah blah blah', 'coolswag'];
var dialogue:Array<String> = ['dad:blah blah blah', 'bf:coolswag'];
var halloweenBG:FlxSprite;
var isHalloween:Bool = false;
@ -569,7 +569,9 @@ class PlayState extends MusicBeatState
add(city);
phillyCityLights = new FlxTypedGroup<FlxSprite>();
if(FlxG.save.data.distractions){
add(phillyCityLights);
}
for (i in 0...5)
{
@ -586,7 +588,9 @@ class PlayState extends MusicBeatState
add(streetBehind);
phillyTrain = new FlxSprite(2000, 360).loadGraphic(Paths.image('philly/train'));
if(FlxG.save.data.distractions){
add(phillyTrain);
}
trainSound = new FlxSound().loadEmbedded(Paths.sound('train_passes'));
FlxG.sound.list.add(trainSound);
@ -611,7 +615,7 @@ class PlayState extends MusicBeatState
bgLimo.animation.play('drive');
bgLimo.scrollFactor.set(0.4, 0.4);
add(bgLimo);
if(FlxG.save.data.distractions){
grpLimoDancers = new FlxTypedGroup<BackgroundDancer>();
add(grpLimoDancers);
@ -621,6 +625,7 @@ class PlayState extends MusicBeatState
dancer.scrollFactor.set(0.4, 0.4);
grpLimoDancers.add(dancer);
}
}
var overlayShit:FlxSprite = new FlxSprite(-500, -600).loadGraphic(Paths.image('limo/limoOverlay'));
overlayShit.alpha = 0.5;
@ -664,7 +669,10 @@ class PlayState extends MusicBeatState
upperBoppers.scrollFactor.set(0.33, 0.33);
upperBoppers.setGraphicSize(Std.int(upperBoppers.width * 0.85));
upperBoppers.updateHitbox();
if(FlxG.save.data.distractions){
add(upperBoppers);
}
var bgEscalator:FlxSprite = new FlxSprite(-1100, -600).loadGraphic(Paths.image('christmas/bgEscalator'));
bgEscalator.antialiasing = true;
@ -686,7 +694,10 @@ class PlayState extends MusicBeatState
bottomBoppers.scrollFactor.set(0.9, 0.9);
bottomBoppers.setGraphicSize(Std.int(bottomBoppers.width * 1));
bottomBoppers.updateHitbox();
if(FlxG.save.data.distractions){
add(bottomBoppers);
}
var fgSnow:FlxSprite = new FlxSprite(-600, 700).loadGraphic(Paths.image('christmas/fgSnow'));
fgSnow.active = false;
@ -697,8 +708,10 @@ class PlayState extends MusicBeatState
santa.frames = Paths.getSparrowAtlas('christmas/santa');
santa.animation.addByPrefix('idle', 'santa idle in fear', 24, false);
santa.antialiasing = true;
if(FlxG.save.data.distractions){
add(santa);
}
}
case 'winter-horrorland':
{
curStage = 'mallEvil';
@ -779,13 +792,17 @@ class PlayState extends MusicBeatState
if (SONG.song.toLowerCase() == 'roses')
{
if(FlxG.save.data.distractions){
bgGirls.getScared();
}
}
bgGirls.setGraphicSize(Std.int(bgGirls.width * daPixelZoom));
bgGirls.updateHitbox();
if(FlxG.save.data.distractions){
add(bgGirls);
}
}
case 'thorns':
{
curStage = 'schoolEvil';
@ -942,9 +959,10 @@ class PlayState extends MusicBeatState
case 'limo':
boyfriend.y -= 220;
boyfriend.x += 260;
if(FlxG.save.data.distractions){
resetFastCar();
add(fastCar);
}
case 'mall':
boyfriend.x += 200;
@ -958,13 +976,15 @@ class PlayState extends MusicBeatState
gf.x += 180;
gf.y += 300;
case 'schoolEvil':
if(FlxG.save.data.distractions){
// trailArea.scrollFactor.set();
var evilTrail = new FlxTrail(dad, null, 4, 24, 0.3, 0.069);
// evilTrail.changeValuesEnabled(false, false, false, false);
// evilTrail.changeGraphic()
add(evilTrail);
// evilTrail.scrollFactor.set(1.1, 1.1);
}
boyfriend.x += 200;
boyfriend.y += 220;
@ -3533,14 +3553,17 @@ class PlayState extends MusicBeatState
function resetFastCar():Void
{
if(FlxG.save.data.distractions){
fastCar.x = -12600;
fastCar.y = FlxG.random.int(140, 250);
fastCar.velocity.x = 0;
fastCarCanDrive = true;
}
}
function fastCarDrive()
{
if(FlxG.save.data.distractions){
FlxG.sound.play(Paths.soundRandom('carPass', 0, 1), 0.7);
fastCar.velocity.x = (FlxG.random.int(170, 220) / FlxG.elapsed) * 3;
@ -3550,6 +3573,7 @@ class PlayState extends MusicBeatState
resetFastCar();
});
}
}
var trainMoving:Bool = false;
var trainFrameTiming:Float = 0;
@ -3560,15 +3584,18 @@ class PlayState extends MusicBeatState
function trainStart():Void
{
if(FlxG.save.data.distractions){
trainMoving = true;
if (!trainSound.playing)
trainSound.play(true);
}
}
var startedMoving:Bool = false;
function updateTrainPos():Void
{
if(FlxG.save.data.distractions){
if (trainSound.time >= 4700)
{
startedMoving = true;
@ -3593,8 +3620,11 @@ class PlayState extends MusicBeatState
}
}
}
function trainReset():Void
{
if(FlxG.save.data.distractions){
gf.playAnim('hairFall');
phillyTrain.x = FlxG.width + 200;
trainMoving = false;
@ -3604,6 +3634,7 @@ class PlayState extends MusicBeatState
trainFinishing = false;
startedMoving = false;
}
}
function lightningStrikeShit():Void
{
@ -3740,14 +3771,19 @@ class PlayState extends MusicBeatState
switch (curStage)
{
case 'school':
if(FlxG.save.data.distractions){
bgGirls.dance();
}
case 'mall':
if(FlxG.save.data.distractions){
upperBoppers.animation.play('bop', true);
bottomBoppers.animation.play('bop', true);
santa.animation.play('idle', true);
}
case 'limo':
if(FlxG.save.data.distractions){
grpLimoDancers.forEach(function(dancer:BackgroundDancer)
{
dancer.dance();
@ -3755,7 +3791,9 @@ class PlayState extends MusicBeatState
if (FlxG.random.bool(10) && fastCarCanDrive)
fastCarDrive();
}
case "philly":
if(FlxG.save.data.distractions){
if (!trainMoving)
trainCooldown += 1;
@ -3772,18 +3810,24 @@ class PlayState extends MusicBeatState
// phillyCityLights.members[curLight].alpha = 1;
}
}
if (curBeat % 8 == 4 && FlxG.random.bool(30) && !trainMoving && trainCooldown > 8)
{
if(FlxG.save.data.distractions){
trainCooldown = FlxG.random.int(-4, 0);
trainStart();
}
}
}
if (isHalloween && FlxG.random.bool(10) && curBeat > lightningStrikeBeat + lightningOffset)
{
if(FlxG.save.data.distractions){
lightningStrikeShit();
}
}
}
var curLight:Int = 0;
}