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;
@ -562,14 +562,16 @@ class PlayState extends MusicBeatState
bg.scrollFactor.set(0.1, 0.1); bg.scrollFactor.set(0.1, 0.1);
add(bg); add(bg);
var city:FlxSprite = new FlxSprite(-10).loadGraphic(Paths.image('philly/city')); var city:FlxSprite = new FlxSprite(-10).loadGraphic(Paths.image('philly/city'));
city.scrollFactor.set(0.3, 0.3); city.scrollFactor.set(0.3, 0.3);
city.setGraphicSize(Std.int(city.width * 0.85)); city.setGraphicSize(Std.int(city.width * 0.85));
city.updateHitbox(); city.updateHitbox();
add(city); add(city);
phillyCityLights = new FlxTypedGroup<FlxSprite>(); phillyCityLights = new FlxTypedGroup<FlxSprite>();
add(phillyCityLights); if(FlxG.save.data.distractions){
add(phillyCityLights);
}
for (i in 0...5) for (i in 0...5)
{ {
@ -585,8 +587,10 @@ class PlayState extends MusicBeatState
var streetBehind:FlxSprite = new FlxSprite(-40, 50).loadGraphic(Paths.image('philly/behindTrain')); var streetBehind:FlxSprite = new FlxSprite(-40, 50).loadGraphic(Paths.image('philly/behindTrain'));
add(streetBehind); add(streetBehind);
phillyTrain = new FlxSprite(2000, 360).loadGraphic(Paths.image('philly/train')); phillyTrain = new FlxSprite(2000, 360).loadGraphic(Paths.image('philly/train'));
add(phillyTrain); if(FlxG.save.data.distractions){
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);
@ -594,7 +598,7 @@ class PlayState extends MusicBeatState
// var cityLights:FlxSprite = new FlxSprite().loadGraphic(AssetPaths.win0.png); // var cityLights:FlxSprite = new FlxSprite().loadGraphic(AssetPaths.win0.png);
var street:FlxSprite = new FlxSprite(-40, streetBehind.y).loadGraphic(Paths.image('philly/street')); var street:FlxSprite = new FlxSprite(-40, streetBehind.y).loadGraphic(Paths.image('philly/street'));
add(street); add(street);
} }
case 'milf' | 'satin-panties' | 'high': case 'milf' | 'satin-panties' | 'high':
{ {
@ -611,15 +615,16 @@ 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);
for (i in 0...5) for (i in 0...5)
{ {
var dancer:BackgroundDancer = new BackgroundDancer((370 * i) + 130, bgLimo.y - 400); var dancer:BackgroundDancer = new BackgroundDancer((370 * i) + 130, bgLimo.y - 400);
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'));
@ -645,7 +650,7 @@ class PlayState extends MusicBeatState
} }
case 'cocoa' | 'eggnog': case 'cocoa' | 'eggnog':
{ {
curStage = 'mall'; curStage = 'mall';
defaultCamZoom = 0.80; defaultCamZoom = 0.80;
@ -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();
add(upperBoppers); if(FlxG.save.data.distractions){
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;
@ -683,10 +691,13 @@ class PlayState extends MusicBeatState
bottomBoppers.frames = Paths.getSparrowAtlas('christmas/bottomBop'); bottomBoppers.frames = Paths.getSparrowAtlas('christmas/bottomBop');
bottomBoppers.animation.addByPrefix('bop', 'Bottom Level Boppers', 24, false); bottomBoppers.animation.addByPrefix('bop', 'Bottom Level Boppers', 24, false);
bottomBoppers.antialiasing = true; bottomBoppers.antialiasing = true;
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();
add(bottomBoppers); if(FlxG.save.data.distractions){
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,7 +708,9 @@ 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;
add(santa); if(FlxG.save.data.distractions){
add(santa);
}
} }
case 'winter-horrorland': case 'winter-horrorland':
{ {
@ -779,12 +792,16 @@ class PlayState extends MusicBeatState
if (SONG.song.toLowerCase() == 'roses') if (SONG.song.toLowerCase() == 'roses')
{ {
bgGirls.getScared(); if(FlxG.save.data.distractions){
} bgGirls.getScared();
}
}
bgGirls.setGraphicSize(Std.int(bgGirls.width * daPixelZoom)); bgGirls.setGraphicSize(Std.int(bgGirls.width * daPixelZoom));
bgGirls.updateHitbox(); bgGirls.updateHitbox();
add(bgGirls); if(FlxG.save.data.distractions){
add(bgGirls);
}
} }
case 'thorns': case 'thorns':
{ {
@ -794,7 +811,7 @@ class PlayState extends MusicBeatState
var waveEffectFG = new FlxWaveEffect(FlxWaveMode.ALL, 2, -1, 5, 2); var waveEffectFG = new FlxWaveEffect(FlxWaveMode.ALL, 2, -1, 5, 2);
var posX = 400; var posX = 400;
var posY = 200; var posY = 200;
var bg:FlxSprite = new FlxSprite(posX, posY); var bg:FlxSprite = new FlxSprite(posX, posY);
bg.frames = Paths.getSparrowAtlas('weeb/animatedEvilSchool'); bg.frames = Paths.getSparrowAtlas('weeb/animatedEvilSchool');
@ -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,22 +3553,26 @@ class PlayState extends MusicBeatState
function resetFastCar():Void function resetFastCar():Void
{ {
fastCar.x = -12600; if(FlxG.save.data.distractions){
fastCar.y = FlxG.random.int(140, 250); fastCar.x = -12600;
fastCar.velocity.x = 0; fastCar.y = FlxG.random.int(140, 250);
fastCarCanDrive = true; fastCar.velocity.x = 0;
fastCarCanDrive = true;
}
} }
function fastCarDrive() function fastCarDrive()
{ {
FlxG.sound.play(Paths.soundRandom('carPass', 0, 1), 0.7); 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; fastCar.velocity.x = (FlxG.random.int(170, 220) / FlxG.elapsed) * 3;
fastCarCanDrive = false; fastCarCanDrive = false;
new FlxTimer().start(2, function(tmr:FlxTimer) new FlxTimer().start(2, function(tmr:FlxTimer)
{ {
resetFastCar(); resetFastCar();
}); });
}
} }
var trainMoving:Bool = false; var trainMoving:Bool = false;
@ -3560,49 +3584,56 @@ 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 (trainSound.time >= 4700) if(FlxG.save.data.distractions){
{ if (trainSound.time >= 4700)
startedMoving = true; {
gf.playAnim('hairBlow'); startedMoving = true;
gf.playAnim('hairBlow');
}
if (startedMoving)
{
phillyTrain.x -= 400;
if (phillyTrain.x < -2000 && !trainFinishing)
{
phillyTrain.x = -1150;
trainCars -= 1;
if (trainCars <= 0)
trainFinishing = true;
}
if (phillyTrain.x < -4000 && trainFinishing)
trainReset();
}
} }
if (startedMoving)
{
phillyTrain.x -= 400;
if (phillyTrain.x < -2000 && !trainFinishing)
{
phillyTrain.x = -1150;
trainCars -= 1;
if (trainCars <= 0)
trainFinishing = true;
}
if (phillyTrain.x < -4000 && trainFinishing)
trainReset();
}
} }
function trainReset():Void function trainReset():Void
{ {
gf.playAnim('hairFall'); if(FlxG.save.data.distractions){
phillyTrain.x = FlxG.width + 200; gf.playAnim('hairFall');
trainMoving = false; phillyTrain.x = FlxG.width + 200;
// trainSound.stop(); trainMoving = false;
// trainSound.time = 0; // trainSound.stop();
trainCars = 8; // trainSound.time = 0;
trainFinishing = false; trainCars = 8;
startedMoving = false; trainFinishing = false;
startedMoving = false;
}
} }
function lightningStrikeShit():Void function lightningStrikeShit():Void
@ -3740,48 +3771,61 @@ class PlayState extends MusicBeatState
switch (curStage) switch (curStage)
{ {
case 'school': case 'school':
bgGirls.dance(); if(FlxG.save.data.distractions){
bgGirls.dance();
}
case 'mall': case 'mall':
upperBoppers.animation.play('bop', true); if(FlxG.save.data.distractions){
bottomBoppers.animation.play('bop', true); upperBoppers.animation.play('bop', true);
santa.animation.play('idle', true); bottomBoppers.animation.play('bop', true);
santa.animation.play('idle', true);
}
case 'limo': case 'limo':
grpLimoDancers.forEach(function(dancer:BackgroundDancer) if(FlxG.save.data.distractions){
{ grpLimoDancers.forEach(function(dancer:BackgroundDancer)
dancer.dance(); {
}); dancer.dance();
});
if (FlxG.random.bool(10) && fastCarCanDrive)
fastCarDrive(); if (FlxG.random.bool(10) && fastCarCanDrive)
fastCarDrive();
}
case "philly": case "philly":
if (!trainMoving) if(FlxG.save.data.distractions){
trainCooldown += 1; if (!trainMoving)
trainCooldown += 1;
if (curBeat % 4 == 0)
{ if (curBeat % 4 == 0)
phillyCityLights.forEach(function(light:FlxSprite)
{ {
light.visible = false; phillyCityLights.forEach(function(light:FlxSprite)
}); {
light.visible = false;
});
curLight = FlxG.random.int(0, phillyCityLights.length - 1);
phillyCityLights.members[curLight].visible = true;
// phillyCityLights.members[curLight].alpha = 1;
}
curLight = FlxG.random.int(0, phillyCityLights.length - 1);
phillyCityLights.members[curLight].visible = true;
// 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)
{ {
trainCooldown = FlxG.random.int(-4, 0); if(FlxG.save.data.distractions){
trainStart(); trainCooldown = FlxG.random.int(-4, 0);
trainStart();
}
} }
} }
if (isHalloween && FlxG.random.bool(10) && curBeat > lightningStrikeBeat + lightningOffset) if (isHalloween && FlxG.random.bool(10) && curBeat > lightningStrikeBeat + lightningOffset)
{ {
lightningStrikeShit(); if(FlxG.save.data.distractions){
lightningStrikeShit();
}
} }
} }