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 class Judgement extends Option
{ {
@ -264,6 +284,8 @@ class FPSOption extends Option
} }
} }
class FPSCapOption extends Option class FPSCapOption extends Option
{ {
public function new(desc:String) public function new(desc:String)

View File

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

View File

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