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