Funkin/source/PlayState.hx

2585 lines
67 KiB
Haxe
Raw Normal View History

2020-10-03 02:50:15 -04:00
package;
2020-10-24 05:19:13 -04:00
import Section.SwagSection;
import Song.SwagSong;
2021-02-02 00:48:22 -05:00
import WiggleEffect.WiggleEffectType;
2020-10-25 16:51:06 -04:00
import flixel.FlxBasic;
import flixel.FlxCamera;
2020-10-03 02:50:15 -04:00
import flixel.FlxG;
2020-10-24 05:19:13 -04:00
import flixel.FlxGame;
2020-10-04 02:42:58 -04:00
import flixel.FlxObject;
2020-10-03 02:50:15 -04:00
import flixel.FlxSprite;
import flixel.FlxState;
2020-10-09 17:24:20 -04:00
import flixel.FlxSubState;
2020-10-04 17:44:52 -04:00
import flixel.addons.display.FlxGridOverlay;
2021-02-02 00:48:22 -05:00
import flixel.addons.effects.FlxTrail;
import flixel.addons.effects.FlxTrailArea;
import flixel.addons.effects.chainable.FlxEffectSprite;
import flixel.addons.effects.chainable.FlxWaveEffect;
2021-02-02 04:13:28 -05:00
import flixel.addons.transition.FlxTransitionableState;
2020-10-04 04:38:21 -04:00
import flixel.graphics.atlas.FlxAtlas;
2020-10-04 02:42:58 -04:00
import flixel.graphics.frames.FlxAtlasFrames;
2020-10-03 02:50:15 -04:00
import flixel.group.FlxGroup.FlxTypedGroup;
2020-10-05 05:48:30 -04:00
import flixel.math.FlxMath;
2020-10-31 21:11:14 -04:00
import flixel.math.FlxPoint;
2021-01-16 17:21:06 -05:00
import flixel.math.FlxRect;
2020-10-03 02:50:15 -04:00
import flixel.system.FlxSound;
import flixel.text.FlxText;
2020-10-05 14:24:51 -04:00
import flixel.tweens.FlxEase;
2020-10-03 15:32:15 -04:00
import flixel.tweens.FlxTween;
2020-10-05 16:32:41 -04:00
import flixel.ui.FlxBar;
2020-10-04 02:42:58 -04:00
import flixel.util.FlxCollision;
import flixel.util.FlxColor;
2020-10-05 01:13:12 -04:00
import flixel.util.FlxSort;
2020-10-04 02:42:58 -04:00
import flixel.util.FlxStringUtil;
2020-10-03 15:32:15 -04:00
import flixel.util.FlxTimer;
2020-10-03 02:50:15 -04:00
import haxe.Json;
import lime.utils.Assets;
2021-04-01 19:39:03 -04:00
import openfl.Lib;
2020-12-26 21:46:22 -05:00
import openfl.display.BlendMode;
2021-02-02 00:48:22 -05:00
import openfl.display.StageQuality;
2020-12-26 21:46:22 -05:00
import openfl.filters.ShaderFilter;
import shaderslmfao.ColorSwap;
2021-03-26 21:28:04 -04:00
import ui.PreferencesMenu;
2020-10-03 02:50:15 -04:00
2020-10-04 02:42:58 -04:00
using StringTools;
2021-03-22 10:09:46 -04:00
#if discord_rpc
import Discord.DiscordClient;
#end
class PlayState extends MusicBeatState
2020-10-03 02:50:15 -04:00
{
2020-12-10 18:23:53 -05:00
public static var curStage:String = '';
2020-10-24 05:19:13 -04:00
public static var SONG:SwagSong;
2020-10-31 21:11:14 -04:00
public static var isStoryMode:Bool = false;
2020-11-06 21:17:27 -05:00
public static var storyWeek:Int = 0;
2020-10-31 21:11:14 -04:00
public static var storyPlaylist:Array<String> = [];
public static var storyDifficulty:Int = 1;
2021-03-04 14:30:35 -05:00
public static var deathCounter:Int = 0;
2021-03-08 18:38:58 -05:00
public static var practiceMode:Bool = false;
2020-10-31 21:11:14 -04:00
var halloweenLevel:Bool = false;
2020-10-05 18:29:59 -04:00
2020-10-04 02:42:58 -04:00
private var vocals:FlxSound;
private var vocalsFinished:Bool = false;
2020-10-03 13:36:39 -04:00
2020-10-18 20:59:53 -04:00
private var dad:Character;
private var gf:Character;
2020-10-04 14:50:12 -04:00
private var boyfriend:Boyfriend;
2020-10-03 02:50:15 -04:00
private var notes:FlxTypedGroup<Note>;
2020-10-05 05:48:30 -04:00
private var unspawnNotes:Array<Note> = [];
2020-10-03 02:50:15 -04:00
private var strumLine:FlxSprite;
2020-10-03 15:32:15 -04:00
private var curSection:Int = 0;
2020-10-04 02:42:58 -04:00
private var camFollow:FlxObject;
2021-02-02 04:13:28 -05:00
private static var prevCamFollow:FlxObject;
2020-10-04 04:38:21 -04:00
private var strumLineNotes:FlxTypedGroup<FlxSprite>;
private var playerStrums:FlxTypedGroup<FlxSprite>;
2020-10-04 02:42:58 -04:00
2020-10-05 05:48:30 -04:00
private var camZooming:Bool = false;
private var curSong:String = "";
2020-10-05 08:55:39 -04:00
private var gfSpeed:Int = 1;
private var health:Float = 1;
2020-10-05 10:03:38 -04:00
private var combo:Int = 0;
2020-10-05 08:55:39 -04:00
2020-10-05 16:32:41 -04:00
private var healthBarBG:FlxSprite;
private var healthBar:FlxBar;
2020-10-05 14:24:51 -04:00
private var generatedMusic:Bool = false;
2020-10-23 19:12:38 -04:00
private var startingSong:Bool = false;
2020-10-05 14:24:51 -04:00
2020-12-24 18:24:11 -05:00
private var iconP1:HealthIcon;
private var iconP2:HealthIcon;
private var camHUD:FlxCamera;
private var camGame:FlxCamera;
2020-10-05 16:32:41 -04:00
2020-10-31 21:11:14 -04:00
var dialogue:Array<String> = ['blah blah blah', 'coolswag'];
var halloweenBG:FlxSprite;
2020-11-02 01:46:37 -05:00
var isHalloween:Bool = false;
2020-10-31 21:11:14 -04:00
2020-12-10 18:23:53 -05:00
var phillyCityLights:FlxTypedGroup<FlxSprite>;
var phillyTrain:FlxSprite;
var trainSound:FlxSound;
2021-03-08 18:38:58 -05:00
var foregroundSprites:FlxTypedGroup<BGSprite>;
2020-12-26 21:46:22 -05:00
var limo:FlxSprite;
2020-12-27 03:13:51 -05:00
var grpLimoDancers:FlxTypedGroup<BackgroundDancer>;
2020-12-27 05:37:04 -05:00
var fastCar:FlxSprite;
2020-12-26 21:46:22 -05:00
2021-01-19 21:09:47 -05:00
var upperBoppers:FlxSprite;
var bottomBoppers:FlxSprite;
2021-01-19 23:29:18 -05:00
var santa:FlxSprite;
2021-01-19 21:09:47 -05:00
2021-01-25 05:04:31 -05:00
var bgGirls:BackgroundGirls;
2021-02-02 00:48:22 -05:00
var wiggleShit:WiggleEffect = new WiggleEffect();
2021-01-25 04:18:44 -05:00
2021-03-16 01:51:23 -04:00
var tankmanRun:FlxTypedGroup<TankmenBG>;
2020-10-31 21:11:14 -04:00
var talking:Bool = true;
2020-11-01 14:16:22 -05:00
var songScore:Int = 0;
2020-11-24 22:53:48 -05:00
var scoreTxt:FlxText;
2020-10-31 21:11:14 -04:00
2020-11-06 21:17:27 -05:00
public static var campaignScore:Int = 0;
2020-12-26 21:46:22 -05:00
var defaultCamZoom:Float = 1.05;
2021-01-25 04:18:44 -05:00
// how big to stretch the pixel art assets
public static var daPixelZoom:Float = 6;
2021-02-02 02:35:35 -05:00
var inCutscene:Bool = false;
2021-03-22 10:09:46 -04:00
#if discord_rpc
// Discord RPC variables
var storyDifficultyText:String = "";
var iconRPC:String = "";
var songLength:Float = 0;
2021-02-27 18:23:50 -05:00
var detailsText:String = "";
var detailsPausedText:String = "";
#end
2020-10-03 02:50:15 -04:00
override public function create()
{
if (FlxG.sound.music != null)
FlxG.sound.music.stop();
2021-04-01 22:28:20 -04:00
FlxG.sound.cache(Paths.inst(PlayState.SONG.song));
FlxG.sound.cache(Paths.voices(PlayState.SONG.song));
// var gameCam:FlxCamera = FlxG.camera;
camGame = new FlxCamera();
camHUD = new FlxCamera();
camHUD.bgColor.alpha = 0;
FlxG.cameras.reset(camGame);
2021-03-23 18:30:58 -04:00
FlxG.cameras.add(camHUD, false);
2021-04-01 22:28:20 -04:00
// fake notesplash cache type deal so that it loads in the graphic?
var noteSplash:NoteSplash = new NoteSplash(100, 100, 0);
add(noteSplash);
noteSplash.alpha = 0.1;
2020-10-05 14:24:51 -04:00
persistentUpdate = true;
persistentDraw = true;
2020-10-13 04:37:19 -04:00
if (SONG == null)
2021-01-25 04:18:44 -05:00
SONG = Song.loadFromJson('tutorial');
2020-10-13 04:37:19 -04:00
Conductor.mapBPMChanges(SONG);
2020-10-30 19:47:19 -04:00
Conductor.changeBPM(SONG.bpm);
2021-03-08 18:38:58 -05:00
foregroundSprites = new FlxTypedGroup<BGSprite>();
2020-10-31 21:11:14 -04:00
switch (SONG.song.toLowerCase())
{
case 'tutorial':
dialogue = ["Hey you're pretty cute.", 'Use the arrow keys to keep up \nwith me singing.'];
case 'bopeebo':
dialogue = [
'HEY!',
"You think you can just sing\nwith my daughter like that?",
"If you want to date her...",
"You're going to have to go \nthrough ME first!"
];
case 'fresh':
dialogue = ["Not too shabby boy.", ""];
case 'dadbattle':
dialogue = [
"gah you think you're hot stuff?",
"If you can beat me here...",
"Only then I will even CONSIDER letting you\ndate my daughter!"
];
2021-02-01 01:50:30 -05:00
case 'senpai':
dialogue = CoolUtil.coolTextFile(Paths.txt('senpai/senpaiDialogue'));
2021-02-01 05:52:10 -05:00
case 'roses':
dialogue = CoolUtil.coolTextFile(Paths.txt('roses/rosesDialogue'));
2021-02-02 04:54:36 -05:00
case 'thorns':
dialogue = CoolUtil.coolTextFile(Paths.txt('thorns/thornsDialogue'));
2020-10-31 21:11:14 -04:00
}
2021-03-31 13:08:55 -04:00
#if discord_rpc
initDiscord();
2021-03-31 13:08:55 -04:00
#end
2021-02-26 07:27:32 -05:00
2021-03-07 15:34:21 -05:00
switch (SONG.song.toLowerCase())
2020-10-31 21:11:14 -04:00
{
case 'spookeez' | 'monster' | 'south':
curStage = "spooky";
halloweenLevel = true;
var hallowTex = Paths.getSparrowAtlas('halloween_bg');
halloweenBG = new FlxSprite(-200, -100);
halloweenBG.frames = hallowTex;
halloweenBG.animation.addByPrefix('idle', 'halloweem bg0');
halloweenBG.animation.addByPrefix('lightning', 'halloweem bg lightning strike', 24, false);
halloweenBG.animation.play('idle');
halloweenBG.antialiasing = true;
add(halloweenBG);
isHalloween = true;
case 'pico' | 'blammed' | 'philly':
curStage = 'philly';
var bg:FlxSprite = new FlxSprite(-100).loadGraphic(Paths.image('philly/sky'));
bg.scrollFactor.set(0.1, 0.1);
add(bg);
2020-11-02 01:46:37 -05:00
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);
2020-12-10 18:23:53 -05:00
phillyCityLights = new FlxTypedGroup<FlxSprite>();
add(phillyCityLights);
2020-12-10 18:23:53 -05:00
for (i in 0...5)
{
var light:FlxSprite = new FlxSprite(city.x).loadGraphic(Paths.image('philly/win' + i));
light.scrollFactor.set(0.3, 0.3);
light.visible = false;
light.setGraphicSize(Std.int(light.width * 0.85));
light.updateHitbox();
light.antialiasing = true;
phillyCityLights.add(light);
}
2020-12-10 18:23:53 -05:00
var streetBehind:FlxSprite = new FlxSprite(-40, 50).loadGraphic(Paths.image('philly/behindTrain'));
add(streetBehind);
2020-12-10 18:23:53 -05:00
phillyTrain = new FlxSprite(2000, 360).loadGraphic(Paths.image('philly/train'));
add(phillyTrain);
2020-12-10 18:23:53 -05:00
trainSound = new FlxSound().loadEmbedded(Paths.sound('train_passes'));
FlxG.sound.list.add(trainSound);
2020-12-10 18:23:53 -05:00
// var cityLights:FlxSprite = new FlxSprite().loadGraphic(AssetPaths.win0.png);
2020-12-10 18:23:53 -05:00
var street:FlxSprite = new FlxSprite(-40, streetBehind.y).loadGraphic(Paths.image('philly/street'));
add(street);
case "milf" | 'satin-panties' | 'high':
curStage = 'limo';
defaultCamZoom = 0.90;
2020-12-10 18:23:53 -05:00
var skyBG:FlxSprite = new FlxSprite(-120, -50).loadGraphic(Paths.image('limo/limoSunset'));
skyBG.scrollFactor.set(0.1, 0.1);
add(skyBG);
2020-12-10 18:23:53 -05:00
var bgLimo:FlxSprite = new FlxSprite(-200, 480);
bgLimo.frames = Paths.getSparrowAtlas('limo/bgLimo');
bgLimo.animation.addByPrefix('drive', "background limo pink", 24);
bgLimo.animation.play('drive');
bgLimo.scrollFactor.set(0.4, 0.4);
add(bgLimo);
2020-12-26 21:46:22 -05:00
grpLimoDancers = new FlxTypedGroup<BackgroundDancer>();
add(grpLimoDancers);
2020-12-26 21:46:22 -05:00
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);
}
2020-12-27 03:13:51 -05:00
var overlayShit:FlxSprite = new FlxSprite(-500, -600).loadGraphic(Paths.image('limo/limoOverlay'));
overlayShit.alpha = 0.5;
// add(overlayShit);
// var shaderBullshit = new BlendModeEffect(new OverlayShader(), FlxColor.RED);
// FlxG.camera.setFilters([new ShaderFilter(cast shaderBullshit.shader)]);
// overlayShit.shader = shaderBullshit;
2020-12-27 03:13:51 -05:00
limo = new FlxSprite(-120, 550);
limo.frames = Paths.getSparrowAtlas('limo/limoDrive');
limo.animation.addByPrefix('drive', "Limo stage", 24);
limo.animation.play('drive');
limo.antialiasing = true;
2020-12-26 21:46:22 -05:00
fastCar = new FlxSprite(-300, 160).loadGraphic(Paths.image('limo/fastCarLol'));
// add(limo);
case "cocoa" | 'eggnog':
curStage = 'mall';
2020-12-26 21:46:22 -05:00
defaultCamZoom = 0.80;
2020-12-26 21:46:22 -05:00
var bg:FlxSprite = new FlxSprite(-1000, -500).loadGraphic(Paths.image('christmas/bgWalls'));
bg.antialiasing = true;
bg.scrollFactor.set(0.2, 0.2);
bg.active = false;
bg.setGraphicSize(Std.int(bg.width * 0.8));
bg.updateHitbox();
add(bg);
2020-12-26 21:46:22 -05:00
upperBoppers = new FlxSprite(-240, -90);
upperBoppers.frames = Paths.getSparrowAtlas('christmas/upperBop');
upperBoppers.animation.addByPrefix('bop', "Upper Crowd Bob", 24, false);
upperBoppers.antialiasing = true;
upperBoppers.scrollFactor.set(0.33, 0.33);
upperBoppers.setGraphicSize(Std.int(upperBoppers.width * 0.85));
upperBoppers.updateHitbox();
add(upperBoppers);
var bgEscalator:FlxSprite = new FlxSprite(-1100, -600).loadGraphic(Paths.image('christmas/bgEscalator'));
bgEscalator.antialiasing = true;
bgEscalator.scrollFactor.set(0.3, 0.3);
bgEscalator.active = false;
bgEscalator.setGraphicSize(Std.int(bgEscalator.width * 0.9));
bgEscalator.updateHitbox();
add(bgEscalator);
var tree:FlxSprite = new FlxSprite(370, -250).loadGraphic(Paths.image('christmas/christmasTree'));
tree.antialiasing = true;
tree.scrollFactor.set(0.40, 0.40);
add(tree);
bottomBoppers = new FlxSprite(-300, 140);
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.updateHitbox();
add(bottomBoppers);
var fgSnow:FlxSprite = new FlxSprite(-600, 700).loadGraphic(Paths.image('christmas/fgSnow'));
fgSnow.active = false;
fgSnow.antialiasing = true;
add(fgSnow);
santa = new FlxSprite(-840, 150);
santa.frames = Paths.getSparrowAtlas('christmas/santa');
santa.animation.addByPrefix('idle', 'santa idle in fear', 24, false);
santa.antialiasing = true;
add(santa);
case 'winter-horrorland':
curStage = 'mallEvil';
var bg:FlxSprite = new FlxSprite(-400, -500).loadGraphic(Paths.image('christmas/evilBG'));
bg.antialiasing = true;
bg.scrollFactor.set(0.2, 0.2);
bg.active = false;
bg.setGraphicSize(Std.int(bg.width * 0.8));
bg.updateHitbox();
add(bg);
2020-12-26 21:46:22 -05:00
var evilTree:FlxSprite = new FlxSprite(300, -300).loadGraphic(Paths.image('christmas/evilTree'));
evilTree.antialiasing = true;
evilTree.scrollFactor.set(0.2, 0.2);
add(evilTree);
var evilSnow:FlxSprite = new FlxSprite(-200, 700).loadGraphic(Paths.image("christmas/evilSnow"));
evilSnow.antialiasing = true;
add(evilSnow);
case 'senpai' | 'roses':
curStage = 'school';
// defaultCamZoom = 0.9;
var bgSky = new FlxSprite().loadGraphic(Paths.image('weeb/weebSky'));
bgSky.scrollFactor.set(0.1, 0.1);
add(bgSky);
var repositionShit = -200;
var bgSchool:FlxSprite = new FlxSprite(repositionShit, 0).loadGraphic(Paths.image('weeb/weebSchool'));
bgSchool.scrollFactor.set(0.6, 0.90);
add(bgSchool);
var bgStreet:FlxSprite = new FlxSprite(repositionShit).loadGraphic(Paths.image('weeb/weebStreet'));
bgStreet.scrollFactor.set(0.95, 0.95);
add(bgStreet);
var fgTrees:FlxSprite = new FlxSprite(repositionShit + 170, 130).loadGraphic(Paths.image('weeb/weebTreesBack'));
fgTrees.scrollFactor.set(0.9, 0.9);
add(fgTrees);
var bgTrees:FlxSprite = new FlxSprite(repositionShit - 380, -800);
var treetex = Paths.getPackerAtlas('weeb/weebTrees');
bgTrees.frames = treetex;
bgTrees.animation.add('treeLoop', [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18], 12);
bgTrees.animation.play('treeLoop');
bgTrees.scrollFactor.set(0.85, 0.85);
add(bgTrees);
var treeLeaves:FlxSprite = new FlxSprite(repositionShit, -40);
treeLeaves.frames = Paths.getSparrowAtlas('weeb/petals');
treeLeaves.animation.addByPrefix('leaves', 'PETALS ALL', 24, true);
treeLeaves.animation.play('leaves');
treeLeaves.scrollFactor.set(0.85, 0.85);
add(treeLeaves);
var widShit = Std.int(bgSky.width * 6);
bgSky.setGraphicSize(widShit);
bgSchool.setGraphicSize(widShit);
bgStreet.setGraphicSize(widShit);
bgTrees.setGraphicSize(Std.int(widShit * 1.4));
fgTrees.setGraphicSize(Std.int(widShit * 0.8));
treeLeaves.setGraphicSize(widShit);
fgTrees.updateHitbox();
bgSky.updateHitbox();
bgSchool.updateHitbox();
bgStreet.updateHitbox();
bgTrees.updateHitbox();
treeLeaves.updateHitbox();
bgGirls = new BackgroundGirls(-100, 190);
bgGirls.scrollFactor.set(0.9, 0.9);
if (SONG.song.toLowerCase() == 'roses')
{
bgGirls.getScared();
}
2020-12-27 05:37:04 -05:00
bgGirls.setGraphicSize(Std.int(bgGirls.width * daPixelZoom));
bgGirls.updateHitbox();
add(bgGirls);
case 'thorns':
curStage = 'schoolEvil';
2021-02-02 00:48:22 -05:00
var waveEffectBG = new FlxWaveEffect(FlxWaveMode.ALL, 2, -1, 3, 2);
var waveEffectFG = new FlxWaveEffect(FlxWaveMode.ALL, 2, -1, 5, 2);
2021-02-02 00:48:22 -05:00
var posX = 400;
var posY = 200;
2021-02-02 00:48:22 -05:00
var bg:FlxSprite = new FlxSprite(posX, posY);
bg.frames = Paths.getSparrowAtlas('weeb/animatedEvilSchool');
bg.animation.addByPrefix('idle', 'background 2', 24);
bg.animation.play('idle');
bg.scrollFactor.set(0.8, 0.9);
bg.scale.set(6, 6);
add(bg);
2021-02-02 00:48:22 -05:00
/*
2021-02-08 16:34:48 -05:00
var bg:FlxSprite = new FlxSprite(posX, posY).loadGraphic(Paths.image('weeb/evilSchoolBG'));
2021-02-02 00:48:22 -05:00
bg.scale.set(6, 6);
// bg.setGraphicSize(Std.int(bg.width * 6));
// bg.updateHitbox();
add(bg);
2021-02-08 16:34:48 -05:00
var fg:FlxSprite = new FlxSprite(posX, posY).loadGraphic(Paths.image('weeb/evilSchoolFG'));
2021-02-02 00:48:22 -05:00
fg.scale.set(6, 6);
// fg.setGraphicSize(Std.int(fg.width * 6));
// fg.updateHitbox();
add(fg);
wiggleShit.effectType = WiggleEffectType.DREAMY;
wiggleShit.waveAmplitude = 0.01;
wiggleShit.waveFrequency = 60;
wiggleShit.waveSpeed = 0.8;
*/
// bg.shader = wiggleShit.shader;
// fg.shader = wiggleShit.shader;
/*
var waveSprite = new FlxEffectSprite(bg, [waveEffectBG]);
var waveSpriteFG = new FlxEffectSprite(fg, [waveEffectFG]);
// Using scale since setGraphicSize() doesnt work???
waveSprite.scale.set(6, 6);
waveSpriteFG.scale.set(6, 6);
waveSprite.setPosition(posX, posY);
waveSpriteFG.setPosition(posX, posY);
waveSprite.scrollFactor.set(0.7, 0.8);
waveSpriteFG.scrollFactor.set(0.9, 0.8);
// waveSprite.setGraphicSize(Std.int(waveSprite.width * 6));
// waveSprite.updateHitbox();
// waveSpriteFG.setGraphicSize(Std.int(fg.width * 6));
// waveSpriteFG.updateHitbox();
add(waveSprite);
add(waveSpriteFG);
*/
2021-03-07 15:34:21 -05:00
case 'guns' | 'stress' | 'ugh':
2021-03-30 16:58:05 -04:00
defaultCamZoom = 0.90;
2021-03-07 15:34:21 -05:00
curStage = 'tank';
2021-03-31 15:41:45 -04:00
var bg:BGSprite = new BGSprite('tankSky', -400, -400, 0, 0);
2021-03-07 15:34:21 -05:00
add(bg);
2021-04-01 21:35:10 -04:00
var tankSky:BGSprite = new BGSprite('tankClouds', FlxG.random.int(-700, -100), FlxG.random.int(-20, 20), 0.1, 0.1);
tankSky.active = true;
tankSky.velocity.x = FlxG.random.float(5, 15);
2021-03-07 15:34:21 -05:00
add(tankSky);
2021-04-01 19:39:03 -04:00
var tankMountains:BGSprite = new BGSprite('tankMountains', -200, 90, 0.2, 0.2);
tankMountains.setGraphicSize(Std.int(tankMountains.width * 1.1));
tankMountains.updateHitbox();
2021-03-07 15:34:21 -05:00
add(tankMountains);
2021-04-01 19:39:03 -04:00
var tankBuildings:BGSprite = new BGSprite('tankBuildings', -200, 200, 0.25, 0.25);
2021-03-07 15:34:21 -05:00
add(tankBuildings);
2021-04-01 19:39:03 -04:00
var tankRuins:BGSprite = new BGSprite('tankRuins', -200, 0, 0.35, 0.35);
2021-03-07 15:34:21 -05:00
add(tankRuins);
2021-03-31 15:41:45 -04:00
var smokeLeft:BGSprite = new BGSprite('smokeLeft', -200, -100, 0.4, 0.4, ['SmokeBlurLeft'], true);
add(smokeLeft);
var smokeRight:BGSprite = new BGSprite('smokeRight', 1100, -100, 0.4, 0.4, ['SmokeRight'], true);
add(smokeRight);
2021-04-01 19:39:03 -04:00
var tankWatchtower:BGSprite = new BGSprite('tankWatchtower', 100, 50, 0.5, 0.5);
2021-03-07 15:34:21 -05:00
add(tankWatchtower);
2021-04-01 21:35:10 -04:00
var tankGround:BGSprite = new BGSprite('tankGround', -420, -150);
tankGround.setGraphicSize(Std.int(tankGround.width * 1.15));
2021-04-01 19:39:03 -04:00
tankGround.updateHitbox();
2021-03-07 15:34:21 -05:00
add(tankGround);
2021-03-16 01:51:23 -04:00
tankmanRun = new FlxTypedGroup<TankmenBG>();
add(tankmanRun);
2021-03-31 15:41:45 -04:00
// smokeLeft.screenCenter();
2021-04-01 19:39:03 -04:00
var fgTank0:BGSprite = new BGSprite('tank0', -500, 650, 1.7, 1.5, ['fg']);
2021-03-08 18:38:58 -05:00
foregroundSprites.add(fgTank0);
2021-04-01 19:39:03 -04:00
var fgTank1:BGSprite = new BGSprite('tank1', -300, 700, 2, 0.2, ['fg']);
2021-03-08 18:38:58 -05:00
foregroundSprites.add(fgTank1);
// just called 'foreground' just cuz small inconsistency no bbiggei
2021-04-01 19:39:03 -04:00
var fgTank2:BGSprite = new BGSprite('tank2', 450, 940, 1.5, 1.5, ['foreground']);
2021-03-08 18:38:58 -05:00
foregroundSprites.add(fgTank2);
2021-04-01 19:39:03 -04:00
var fgTank4:BGSprite = new BGSprite('tank4', 1200, 1080, 1.5, 1.5, ['fg']);
2021-03-08 18:38:58 -05:00
foregroundSprites.add(fgTank4);
2021-04-01 19:39:03 -04:00
var fgTank5:BGSprite = new BGSprite('tank5', 1800, 900, 1.5, 1.5, ['fg']);
2021-03-08 18:38:58 -05:00
foregroundSprites.add(fgTank5);
2021-04-01 19:39:03 -04:00
var fgTank3:BGSprite = new BGSprite('tank3', 1300, 1430, 3.5, 2.5, ['fg']);
2021-03-08 18:38:58 -05:00
foregroundSprites.add(fgTank3);
default:
defaultCamZoom = 0.9;
curStage = 'stage';
2021-03-07 15:34:21 -05:00
var bg:BGSprite = new BGSprite('stageback', -600, -200, 0.9, 0.9);
add(bg);
var stageFront:FlxSprite = new FlxSprite(-650, 600).loadGraphic(Paths.image('stagefront'));
stageFront.setGraphicSize(Std.int(stageFront.width * 1.1));
stageFront.updateHitbox();
stageFront.antialiasing = true;
stageFront.scrollFactor.set(0.9, 0.9);
stageFront.active = false;
add(stageFront);
var stageCurtains:FlxSprite = new FlxSprite(-500, -300).loadGraphic(Paths.image('stagecurtains'));
stageCurtains.setGraphicSize(Std.int(stageCurtains.width * 0.9));
stageCurtains.updateHitbox();
stageCurtains.antialiasing = true;
stageCurtains.scrollFactor.set(1.3, 1.3);
stageCurtains.active = false;
add(stageCurtains);
2020-10-31 21:11:14 -04:00
}
2020-10-05 16:55:48 -04:00
2021-01-14 23:33:12 -05:00
var gfVersion:String = 'gf';
2021-01-19 21:09:47 -05:00
switch (curStage)
{
case 'limo':
gfVersion = 'gf-car';
2021-02-12 01:20:20 -05:00
case 'mall' | 'mallEvil':
2021-01-20 04:03:49 -05:00
gfVersion = 'gf-christmas';
2021-01-25 04:18:44 -05:00
case 'school':
gfVersion = 'gf-pixel';
2021-02-02 00:48:22 -05:00
case 'schoolEvil':
gfVersion = 'gf-pixel';
2021-01-19 21:09:47 -05:00
}
2021-03-13 20:53:57 -05:00
if (SONG.song.toLowerCase() == 'stress')
gfVersion = 'pico-speaker';
2021-01-14 23:33:12 -05:00
gf = new Character(400, 130, gfVersion);
2020-10-05 07:46:57 -04:00
gf.scrollFactor.set(0.95, 0.95);
2021-03-13 20:53:57 -05:00
switch (gfVersion)
{
case 'pico-speaker':
gf.x -= 50;
gf.y -= 200;
2021-03-30 16:58:05 -04:00
for (i in 0...TankmenBG.animationNotes.length)
{
2021-04-01 21:35:10 -04:00
if (FlxG.random.bool(50))
{
var tankman:TankmenBG = new TankmenBG(500, 200 + FlxG.random.int(0, 150), TankmenBG.animationNotes[i][1] < 2);
tankman.strumTime = TankmenBG.animationNotes[i][0];
tankmanRun.add(tankman);
}
2021-03-30 16:58:05 -04:00
}
2021-03-13 20:53:57 -05:00
}
2020-10-18 20:59:53 -04:00
dad = new Character(100, 100, SONG.player2);
2020-10-03 02:50:15 -04:00
2020-10-31 21:11:14 -04:00
var camPos:FlxPoint = new FlxPoint(dad.getGraphicMidpoint().x, dad.getGraphicMidpoint().y);
2020-10-23 19:12:38 -04:00
switch (SONG.player2)
2020-10-18 20:59:53 -04:00
{
2020-10-23 19:12:38 -04:00
case 'gf':
dad.setPosition(gf.x, gf.y);
gf.visible = false;
2020-10-31 21:11:14 -04:00
if (isStoryMode)
{
camPos.x += 600;
tweenCamIn();
}
2020-10-23 19:12:38 -04:00
case "spooky":
dad.y += 200;
2020-10-30 19:47:19 -04:00
case "monster":
dad.y += 100;
2021-01-20 01:38:39 -05:00
case 'monster-christmas':
dad.y += 130;
2020-10-31 21:11:14 -04:00
case 'dad':
camPos.x += 400;
2020-12-09 17:46:47 -05:00
case 'pico':
2020-12-10 18:23:53 -05:00
camPos.x += 600;
2020-12-09 17:46:47 -05:00
dad.y += 300;
2021-01-19 21:09:47 -05:00
case 'parents-christmas':
dad.x -= 500;
2021-01-25 06:07:45 -05:00
case 'senpai':
dad.x += 150;
2021-01-31 09:17:56 -05:00
dad.y += 360;
camPos.set(dad.getGraphicMidpoint().x + 300, dad.getGraphicMidpoint().y);
2021-02-02 03:24:34 -05:00
case 'senpai-angry':
dad.x += 150;
dad.y += 360;
camPos.set(dad.getGraphicMidpoint().x + 300, dad.getGraphicMidpoint().y);
2021-02-02 00:48:22 -05:00
case 'spirit':
dad.x -= 150;
dad.y += 100;
camPos.set(dad.getGraphicMidpoint().x + 300, dad.getGraphicMidpoint().y);
2021-03-04 14:30:35 -05:00
case 'tankman':
dad.y += 180;
2020-10-18 20:59:53 -04:00
}
2021-01-13 22:38:31 -05:00
boyfriend = new Boyfriend(770, 450, SONG.player1);
2020-10-03 02:50:15 -04:00
2021-03-17 05:29:04 -04:00
switch (SONG.player1)
{
case "bf-holding-gf":
2021-04-01 19:39:03 -04:00
// boyfriend.y -= 140;
2021-03-17 05:29:04 -04:00
}
2020-12-26 21:46:22 -05:00
// REPOSITIONING PER STAGE
switch (curStage)
{
case 'limo':
2021-01-20 05:31:43 -05:00
boyfriend.y -= 220;
boyfriend.x += 260;
resetFastCar();
add(fastCar);
2020-12-27 05:37:04 -05:00
2021-01-19 22:58:07 -05:00
case 'mall':
2021-01-20 05:31:43 -05:00
boyfriend.x += 200;
case 'mallEvil':
boyfriend.x += 320;
dad.y -= 80;
2021-01-24 22:42:51 -05:00
case 'school':
2021-02-02 00:48:22 -05:00
boyfriend.x += 200;
boyfriend.y += 220;
gf.x += 180;
gf.y += 300;
case 'schoolEvil':
// 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);
2021-01-31 09:17:56 -05:00
boyfriend.x += 200;
boyfriend.y += 220;
gf.x += 180;
gf.y += 300;
2021-04-01 19:39:03 -04:00
case "tank":
2021-04-01 21:35:10 -04:00
gf.y += 10;
gf.x -= 30;
boyfriend.x += 40;
boyfriend.y += 0;
dad.y += 60;
2021-04-01 19:39:03 -04:00
dad.x -= 80;
2021-04-01 21:43:53 -04:00
if (gfVersion != 'pico-speaker')
{
gf.x -= 80;
gf.y -= 75;
}
2020-12-26 21:46:22 -05:00
}
2021-02-02 00:48:22 -05:00
add(gf);
2021-02-14 03:32:24 -05:00
// Shitty layering but whatev it works LOL
if (curStage == 'limo')
add(limo);
2021-02-02 00:48:22 -05:00
add(dad);
add(boyfriend);
2021-03-08 18:38:58 -05:00
add(foregroundSprites);
2020-10-31 21:11:14 -04:00
var doof:DialogueBox = new DialogueBox(false, dialogue);
// doof.x += 70;
2021-02-01 01:50:30 -05:00
// doof.y = FlxG.height * 0.5;
2020-10-31 21:11:14 -04:00
doof.scrollFactor.set();
doof.finishThing = startCountdown;
Conductor.songPosition = -5000;
2020-10-05 16:55:48 -04:00
2020-10-04 04:38:21 -04:00
strumLine = new FlxSprite(0, 50).makeGraphic(FlxG.width, 10);
2021-03-30 18:10:15 -04:00
if (PreferencesMenu.getPref('downscroll'))
{
strumLine.y = FlxG.height - 150; // 150 just random ass number lol
}
2020-10-04 04:38:21 -04:00
strumLine.scrollFactor.set();
strumLineNotes = new FlxTypedGroup<FlxSprite>();
add(strumLineNotes);
playerStrums = new FlxTypedGroup<FlxSprite>();
2020-10-31 21:11:14 -04:00
// startCountdown();
2020-10-05 14:24:51 -04:00
2021-03-29 13:24:49 -04:00
generateSong();
2020-10-23 19:12:38 -04:00
// add(strumLine);
camFollow = new FlxObject(0, 0, 1, 1);
2020-10-31 21:11:14 -04:00
camFollow.setPosition(camPos.x, camPos.y);
2021-02-02 04:13:28 -05:00
if (prevCamFollow != null)
{
camFollow = prevCamFollow;
prevCamFollow = null;
}
2020-10-23 19:12:38 -04:00
add(camFollow);
FlxG.camera.follow(camFollow, LOCKON, 0.04);
// FlxG.camera.setScrollBounds(0, FlxG.width, 0, FlxG.height);
2020-12-26 21:46:22 -05:00
FlxG.camera.zoom = defaultCamZoom;
2021-01-31 09:17:56 -05:00
FlxG.camera.focusOn(camFollow.getPosition());
2020-10-23 19:12:38 -04:00
FlxG.worldBounds.set(0, 0, FlxG.width, FlxG.height);
FlxG.fixedTimestep = false;
2021-02-08 16:34:48 -05:00
healthBarBG = new FlxSprite(0, FlxG.height * 0.9).loadGraphic(Paths.image('healthBar'));
2020-10-23 19:12:38 -04:00
healthBarBG.screenCenter(X);
healthBarBG.scrollFactor.set();
add(healthBarBG);
2021-03-30 18:10:15 -04:00
if (PreferencesMenu.getPref('downscroll'))
healthBarBG.y = FlxG.height * 0.1;
2020-10-23 19:12:38 -04:00
healthBar = new FlxBar(healthBarBG.x + 4, healthBarBG.y + 4, RIGHT_TO_LEFT, Std.int(healthBarBG.width - 8), Std.int(healthBarBG.height - 8), this,
'health', 0, 2);
healthBar.scrollFactor.set();
healthBar.createFilledBar(0xFFFF0000, 0xFF66FF33);
// healthBar
add(healthBar);
2020-11-24 22:53:48 -05:00
scoreTxt = new FlxText(healthBarBG.x + healthBarBG.width - 190, healthBarBG.y + 30, 0, "", 20);
scoreTxt.setFormat(Paths.font("vcr.ttf"), 16, FlxColor.WHITE, RIGHT, FlxTextBorderStyle.OUTLINE, FlxColor.BLACK);
2020-11-24 22:53:48 -05:00
scoreTxt.scrollFactor.set();
add(scoreTxt);
2020-12-24 18:24:11 -05:00
iconP1 = new HealthIcon(SONG.player1, true);
iconP1.y = healthBar.y - (iconP1.height / 2);
add(iconP1);
iconP2 = new HealthIcon(SONG.player2, false);
iconP2.y = healthBar.y - (iconP2.height / 2);
add(iconP2);
strumLineNotes.cameras = [camHUD];
notes.cameras = [camHUD];
2020-10-30 19:47:19 -04:00
healthBar.cameras = [camHUD];
healthBarBG.cameras = [camHUD];
2020-12-24 18:24:11 -05:00
iconP1.cameras = [camHUD];
iconP2.cameras = [camHUD];
2020-11-24 22:53:48 -05:00
scoreTxt.cameras = [camHUD];
2020-10-31 21:11:14 -04:00
doof.cameras = [camHUD];
2020-10-30 19:47:19 -04:00
// if (SONG.song == 'South')
// FlxG.camera.alpha = 0.7;
// UI_camera.zoom = 1;
// cameras = [FlxG.cameras.list[1]];
2021-01-20 04:03:49 -05:00
startingSong = true;
if (isStoryMode)
{
switch (curSong.toLowerCase())
{
case "winter-horrorland":
var blackScreen:FlxSprite = new FlxSprite(0, 0).makeGraphic(Std.int(FlxG.width * 2), Std.int(FlxG.height * 2), FlxColor.BLACK);
add(blackScreen);
blackScreen.scrollFactor.set();
2021-01-20 05:31:43 -05:00
camHUD.visible = false;
2021-01-20 04:03:49 -05:00
2021-01-20 05:31:43 -05:00
new FlxTimer().start(0.1, function(tmr:FlxTimer)
2021-01-20 04:03:49 -05:00
{
remove(blackScreen);
2021-02-08 16:34:48 -05:00
FlxG.sound.play(Paths.sound('Lights_Turn_On'));
2021-01-20 04:03:49 -05:00
camFollow.y = -2050;
camFollow.x += 200;
FlxG.camera.focusOn(camFollow.getPosition());
FlxG.camera.zoom = 1.5;
new FlxTimer().start(0.8, function(tmr:FlxTimer)
{
2021-01-20 05:31:43 -05:00
camHUD.visible = true;
2021-01-20 04:03:49 -05:00
remove(blackScreen);
FlxTween.tween(FlxG.camera, {zoom: defaultCamZoom}, 2.5, {
ease: FlxEase.quadInOut,
onComplete: function(twn:FlxTween)
{
startCountdown();
}
});
});
});
2021-01-25 04:18:44 -05:00
case 'senpai':
2021-02-01 01:50:30 -05:00
schoolIntro(doof);
case 'roses':
2021-02-08 16:34:48 -05:00
FlxG.sound.play(Paths.sound('ANGRY'));
2021-02-02 04:54:36 -05:00
schoolIntro(doof);
case 'thorns':
2021-02-01 01:50:30 -05:00
schoolIntro(doof);
2021-01-20 04:03:49 -05:00
default:
startCountdown();
}
}
else
{
2021-01-25 04:18:44 -05:00
switch (curSong.toLowerCase())
{
default:
startCountdown();
}
2021-01-20 04:03:49 -05:00
}
2020-10-25 16:51:06 -04:00
2020-10-23 19:12:38 -04:00
super.create();
}
function initDiscord():Void
{
2021-03-22 10:09:46 -04:00
#if discord_rpc
storyDifficultyText = CoolUtil.difficultyString();
iconRPC = SONG.player2;
// To avoid having duplicate images in Discord assets
switch (iconRPC)
{
case 'senpai-angry':
iconRPC = 'senpai';
case 'monster-christmas':
iconRPC = 'monster';
case 'mom-car':
iconRPC = 'mom';
}
// String that contains the mode defined here so it isn't necessary to call changePresence for each mode
detailsText = isStoryMode ? "Story Mode: Week " + storyWeek : "Freeplay";
detailsPausedText = "Paused - " + detailsText;
// Updating Discord Rich Presence.
DiscordClient.changePresence(detailsText, SONG.song + " (" + storyDifficultyText + ")", iconRPC);
#end
}
2021-02-01 01:50:30 -05:00
function schoolIntro(?dialogueBox:DialogueBox):Void
2021-01-25 04:18:44 -05:00
{
var black:FlxSprite = new FlxSprite(-100, -100).makeGraphic(FlxG.width * 2, FlxG.height * 2, FlxColor.BLACK);
black.scrollFactor.set();
add(black);
2021-02-02 05:46:17 -05:00
var red:FlxSprite = new FlxSprite(-100, -100).makeGraphic(FlxG.width * 2, FlxG.height * 2, 0xFFff1b31);
red.scrollFactor.set();
var senpaiEvil:FlxSprite = new FlxSprite();
2021-02-08 16:34:48 -05:00
senpaiEvil.frames = Paths.getSparrowAtlas('weeb/senpaiCrazy');
2021-02-02 05:46:17 -05:00
senpaiEvil.animation.addByPrefix('idle', 'Senpai Pre Explosion', 24, false);
senpaiEvil.setGraphicSize(Std.int(senpaiEvil.width * 6));
2021-02-12 01:20:20 -05:00
senpaiEvil.scrollFactor.set();
2021-02-02 05:46:17 -05:00
senpaiEvil.updateHitbox();
senpaiEvil.screenCenter();
if (SONG.song.toLowerCase() == 'roses' || SONG.song.toLowerCase() == 'thorns')
{
2021-02-02 04:13:28 -05:00
remove(black);
2021-02-02 05:46:17 -05:00
if (SONG.song.toLowerCase() == 'thorns')
{
add(red);
}
}
2021-01-25 04:18:44 -05:00
new FlxTimer().start(0.3, function(tmr:FlxTimer)
{
black.alpha -= 0.15;
if (black.alpha > 0)
{
tmr.reset(0.3);
}
else
{
2021-02-01 01:50:30 -05:00
if (dialogueBox != null)
{
2021-02-02 02:35:35 -05:00
inCutscene = true;
2021-02-02 05:46:17 -05:00
if (SONG.song.toLowerCase() == 'thorns')
{
add(senpaiEvil);
senpaiEvil.alpha = 0;
new FlxTimer().start(0.3, function(swagTimer:FlxTimer)
{
senpaiEvil.alpha += 0.15;
if (senpaiEvil.alpha < 1)
{
swagTimer.reset();
}
else
{
senpaiEvil.animation.play('idle');
2021-02-08 16:34:48 -05:00
FlxG.sound.play(Paths.sound('Senpai_Dies'), 1, false, null, true, function()
2021-02-02 05:46:17 -05:00
{
remove(senpaiEvil);
remove(red);
FlxG.camera.fade(FlxColor.WHITE, 0.01, true, function()
{
add(dialogueBox);
}, true);
});
new FlxTimer().start(3.2, function(deadTime:FlxTimer)
{
FlxG.camera.fade(FlxColor.WHITE, 1.6, false);
});
}
});
}
else
{
add(dialogueBox);
}
2021-02-01 01:50:30 -05:00
}
else
startCountdown();
2021-01-25 04:18:44 -05:00
remove(black);
}
});
}
var startTimer:FlxTimer = new FlxTimer();
2020-12-22 20:55:03 -05:00
var perfectMode:Bool = false;
2020-10-23 19:12:38 -04:00
function startCountdown():Void
{
2021-02-02 02:35:35 -05:00
inCutscene = false;
2020-10-31 21:11:14 -04:00
generateStaticArrows(0);
generateStaticArrows(1);
talking = false;
2020-10-23 19:12:38 -04:00
startedCountdown = true;
2020-10-05 18:29:59 -04:00
Conductor.songPosition = 0;
2020-10-05 16:32:41 -04:00
Conductor.songPosition -= Conductor.crochet * 5;
2020-10-05 14:24:51 -04:00
2020-10-23 19:12:38 -04:00
var swagCounter:Int = 0;
startTimer.start(Conductor.crochet / 1000, function(tmr:FlxTimer)
2020-10-05 14:24:51 -04:00
{
// this just based on beatHit stuff but compact
if (swagCounter % gfSpeed == 0)
gf.dance();
if (swagCounter % 2 == 0)
{
if (!boyfriend.animation.curAnim.name.startsWith("sing"))
boyfriend.playAnim('idle');
if (!dad.animation.curAnim.name.startsWith("sing"))
dad.dance();
}
else if (dad.curCharacter == 'spooky' && !dad.animation.curAnim.name.startsWith("sing"))
dad.dance();
if (generatedMusic)
notes.sort(sortNotes, FlxSort.DESCENDING);
2020-10-30 19:47:19 -04:00
2021-01-25 04:18:44 -05:00
var introAssets:Map<String, Array<String>> = new Map<String, Array<String>>();
introAssets.set('default', ['ready', "set", "go"]);
2021-03-04 14:30:35 -05:00
introAssets.set('school', ['weeb/pixelUI/ready-pixel', 'weeb/pixelUI/set-pixel', 'weeb/pixelUI/date-pixel']);
introAssets.set('schoolEvil', ['weeb/pixelUI/ready-pixel', 'weeb/pixelUI/set-pixel', 'weeb/pixelUI/date-pixel']);
2021-01-25 04:18:44 -05:00
var introAlts:Array<String> = introAssets.get('default');
2021-01-25 15:56:42 -05:00
var altSuffix:String = "";
2021-01-25 04:18:44 -05:00
for (value in introAssets.keys())
{
if (value == curStage)
2021-01-25 15:56:42 -05:00
{
2021-01-25 04:18:44 -05:00
introAlts = introAssets.get(value);
2021-01-25 15:56:42 -05:00
altSuffix = '-pixel';
}
2021-01-25 04:18:44 -05:00
}
2020-10-05 14:24:51 -04:00
switch (swagCounter)
2021-01-25 04:18:44 -05:00
2020-10-05 14:24:51 -04:00
{
case 0:
2021-03-28 17:36:14 -04:00
FlxG.sound.play(Paths.sound('intro3' + altSuffix), 0.6);
2020-10-05 14:24:51 -04:00
case 1:
var ready:FlxSprite = new FlxSprite().loadGraphic(Paths.image(introAlts[0]));
2020-10-05 14:33:56 -04:00
ready.scrollFactor.set();
2021-01-25 04:18:44 -05:00
ready.updateHitbox();
2021-02-02 00:48:22 -05:00
if (curStage.startsWith('school'))
2021-01-25 04:18:44 -05:00
ready.setGraphicSize(Std.int(ready.width * daPixelZoom));
2020-10-05 14:33:56 -04:00
ready.screenCenter();
add(ready);
FlxTween.tween(ready, {y: ready.y += 100, alpha: 0}, Conductor.crochet / 1000, {
ease: FlxEase.cubeInOut,
onComplete: function(twn:FlxTween)
{
ready.destroy();
}
});
2021-03-28 17:36:14 -04:00
FlxG.sound.play(Paths.sound('intro2' + altSuffix), 0.6);
2020-10-05 14:24:51 -04:00
case 2:
var set:FlxSprite = new FlxSprite().loadGraphic(Paths.image(introAlts[1]));
2020-10-05 14:33:56 -04:00
set.scrollFactor.set();
2021-01-25 04:18:44 -05:00
2021-02-02 00:48:22 -05:00
if (curStage.startsWith('school'))
2021-01-25 04:18:44 -05:00
set.setGraphicSize(Std.int(set.width * daPixelZoom));
2020-10-05 14:33:56 -04:00
set.screenCenter();
add(set);
FlxTween.tween(set, {y: set.y += 100, alpha: 0}, Conductor.crochet / 1000, {
ease: FlxEase.cubeInOut,
onComplete: function(twn:FlxTween)
{
set.destroy();
}
});
2021-03-28 17:36:14 -04:00
FlxG.sound.play(Paths.sound('intro1' + altSuffix), 0.6);
2020-10-05 14:24:51 -04:00
case 3:
var go:FlxSprite = new FlxSprite().loadGraphic(Paths.image(introAlts[2]));
2020-10-05 14:33:56 -04:00
go.scrollFactor.set();
2021-01-25 04:18:44 -05:00
2021-02-02 00:48:22 -05:00
if (curStage.startsWith('school'))
2021-01-25 04:18:44 -05:00
go.setGraphicSize(Std.int(go.width * daPixelZoom));
go.updateHitbox();
2020-10-05 14:33:56 -04:00
go.screenCenter();
add(go);
FlxTween.tween(go, {y: go.y += 100, alpha: 0}, Conductor.crochet / 1000, {
ease: FlxEase.cubeInOut,
onComplete: function(twn:FlxTween)
{
go.destroy();
}
});
2021-03-28 17:36:14 -04:00
FlxG.sound.play(Paths.sound('introGo' + altSuffix), 0.6);
2020-10-05 14:24:51 -04:00
}
swagCounter += 1;
// generateSong('fresh');
}, 4);
2020-10-03 02:50:15 -04:00
}
2020-10-24 05:19:13 -04:00
var previousFrameTime:Int = 0;
var lastReportedPlayheadPosition:Int = 0;
var songTime:Float = 0;
2020-10-05 14:24:51 -04:00
function startSong():Void
{
startingSong = false;
2020-10-24 05:19:13 -04:00
previousFrameTime = FlxG.game.ticks;
lastReportedPlayheadPosition = 0;
if (!paused)
FlxG.sound.playMusic(Paths.inst(PlayState.SONG.song), 1, false);
2020-10-31 21:11:14 -04:00
FlxG.sound.music.onComplete = endSong;
2020-10-05 14:24:51 -04:00
vocals.play();
2021-03-22 10:09:46 -04:00
#if discord_rpc
// Song duration in a float, useful for the time left feature
songLength = FlxG.sound.music.length;
// Updating Discord Rich Presence (with Time Left)
2021-02-27 18:23:50 -05:00
DiscordClient.changePresence(detailsText, SONG.song + " (" + storyDifficultyText + ")", iconRPC, true, songLength);
#end
2020-10-05 14:24:51 -04:00
}
2020-10-03 02:50:15 -04:00
var debugNum:Int = 0;
2021-03-29 13:24:49 -04:00
private function generateSong():Void
2020-10-03 02:50:15 -04:00
{
2020-10-04 02:42:58 -04:00
// FlxG.log.add(ChartParser.parse());
2020-10-13 04:37:19 -04:00
var songData = SONG;
2020-10-04 20:53:49 -04:00
Conductor.changeBPM(songData.bpm);
2020-10-04 02:42:58 -04:00
2020-10-05 05:48:30 -04:00
curSong = songData.song;
2020-10-14 04:30:54 -04:00
if (SONG.needsVoices)
vocals = new FlxSound().loadEmbedded(Paths.voices(PlayState.SONG.song));
2020-10-14 04:30:54 -04:00
else
vocals = new FlxSound();
vocals.onComplete = function(){
vocalsFinished = true;
};
2020-10-04 02:42:58 -04:00
FlxG.sound.list.add(vocals);
2020-10-03 02:50:15 -04:00
notes = new FlxTypedGroup<Note>();
add(notes);
2020-10-24 05:19:13 -04:00
var noteData:Array<SwagSection>;
2020-10-04 02:42:58 -04:00
2020-10-13 04:37:19 -04:00
// NEW SHIT
noteData = songData.notes;
2020-10-03 02:50:15 -04:00
var playerCounter:Int = 0;
var daBeats:Int = 0; // Not exactly representative of 'daBeats' lol, just how much it has looped
for (section in noteData)
2020-10-03 02:50:15 -04:00
{
var coolSection:Int = Std.int(section.lengthInSteps / 4);
2020-10-04 20:53:49 -04:00
2020-10-18 20:59:53 -04:00
for (songNotes in section.sectionNotes)
{
2020-10-19 21:59:00 -04:00
var daStrumTime:Float = songNotes[0];
var daNoteData:Int = Std.int(songNotes[1] % 4);
2020-10-17 21:47:59 -04:00
var gottaHitNote:Bool = section.mustHitSection;
2020-10-30 19:47:19 -04:00
if (songNotes[1] > 3)
2020-10-17 21:47:59 -04:00
{
gottaHitNote = !section.mustHitSection;
}
2020-10-13 04:37:19 -04:00
var oldNote:Note;
if (unspawnNotes.length > 0)
oldNote = unspawnNotes[Std.int(unspawnNotes.length - 1)];
else
oldNote = null;
2020-10-05 01:13:12 -04:00
var swagNote:Note = new Note(daStrumTime, daNoteData, oldNote);
2020-10-19 21:59:00 -04:00
swagNote.sustainLength = songNotes[2];
swagNote.scrollFactor.set(0, 0);
2020-10-03 02:50:15 -04:00
2020-10-19 21:59:00 -04:00
var susLength:Float = swagNote.sustainLength;
susLength = susLength / Conductor.stepCrochet;
unspawnNotes.push(swagNote);
2020-10-05 05:48:30 -04:00
2020-10-19 21:59:00 -04:00
for (susNote in 0...Math.floor(susLength))
{
oldNote = unspawnNotes[Std.int(unspawnNotes.length - 1)];
2020-10-21 16:12:32 -04:00
var sustainNote:Note = new Note(daStrumTime + (Conductor.stepCrochet * susNote) + Conductor.stepCrochet, daNoteData, oldNote, true);
2020-10-19 21:59:00 -04:00
sustainNote.scrollFactor.set();
unspawnNotes.push(sustainNote);
sustainNote.mustPress = gottaHitNote;
if (sustainNote.mustPress)
{
sustainNote.x += FlxG.width / 2; // general offset
}
}
2020-10-17 21:47:59 -04:00
swagNote.mustPress = gottaHitNote;
2020-10-03 02:50:15 -04:00
if (swagNote.mustPress)
{
2020-10-16 07:15:17 -04:00
swagNote.x += FlxG.width / 2; // general offset
}
2021-03-26 20:09:04 -04:00
else {}
2020-10-03 02:50:15 -04:00
}
daBeats += 1;
2020-10-03 02:50:15 -04:00
}
2020-10-05 05:48:30 -04:00
2020-11-06 21:17:27 -05:00
// trace(unspawnNotes.length);
// playerCounter += 1;
2020-10-05 05:48:30 -04:00
unspawnNotes.sort(sortByShit);
2020-10-18 03:27:39 -04:00
generatedMusic = true;
2020-10-05 05:48:30 -04:00
}
2021-04-01 22:28:20 -04:00
// Now you are probably wondering why I made 2 of these very similar functions
// sortByShit(), and sortNotes(). sortNotes is meant to be used by both sortByShit(), and the notes FlxGroup
// sortByShit() is meant to be used only by the unspawnNotes array.
// and the array sorting function doesnt need that order variable thingie
// this is good enough for now lololol HERE IS COMMENT FOR THIS SORTA DUMB DECISION LOL
2020-10-05 05:48:30 -04:00
function sortByShit(Obj1:Note, Obj2:Note):Int
{
2021-04-01 22:28:20 -04:00
return sortNotes(FlxSort.ASCENDING, Obj1, Obj2);
}
function sortNotes(order:Int = FlxSort.ASCENDING, Obj1:Note, Obj2:Note)
{
return FlxSort.byValues(order, Obj1.strumTime, Obj2.strumTime);
2020-10-03 02:50:15 -04:00
}
2021-04-01 22:28:20 -04:00
// ^ These two sorts also look cute together ^
2020-10-04 04:38:21 -04:00
private function generateStaticArrows(player:Int):Void
{
for (i in 0...4)
{
2021-01-25 04:18:44 -05:00
// FlxG.log.add(i);
2020-10-04 04:38:21 -04:00
var babyArrow:FlxSprite = new FlxSprite(0, strumLine.y);
var colorswap:ColorSwap = new ColorSwap();
babyArrow.shader = colorswap.shader;
colorswap.update(Note.arrowColors[i]);
2020-10-04 04:38:21 -04:00
2021-01-25 04:18:44 -05:00
switch (curStage)
{
2021-02-11 14:54:16 -05:00
case 'school' | 'schoolEvil':
2021-02-08 16:34:48 -05:00
babyArrow.loadGraphic(Paths.image('weeb/pixelUI/arrows-pixels'), true, 17, 17);
2021-02-02 00:48:22 -05:00
babyArrow.animation.add('green', [6]);
babyArrow.animation.add('red', [7]);
babyArrow.animation.add('blue', [5]);
babyArrow.animation.add('purplel', [4]);
babyArrow.setGraphicSize(Std.int(babyArrow.width * daPixelZoom));
babyArrow.updateHitbox();
babyArrow.antialiasing = false;
switch (Math.abs(i))
{
2021-02-13 17:39:31 -05:00
case 0:
babyArrow.x += Note.swagWidth * 0;
babyArrow.animation.add('static', [0]);
babyArrow.animation.add('pressed', [4, 8], 12, false);
babyArrow.animation.add('confirm', [12, 16], 24, false);
case 1:
babyArrow.x += Note.swagWidth * 1;
babyArrow.animation.add('static', [1]);
babyArrow.animation.add('pressed', [5, 9], 12, false);
babyArrow.animation.add('confirm', [13, 17], 24, false);
2021-02-02 00:48:22 -05:00
case 2:
babyArrow.x += Note.swagWidth * 2;
babyArrow.animation.add('static', [2]);
babyArrow.animation.add('pressed', [6, 10], 12, false);
babyArrow.animation.add('confirm', [14, 18], 12, false);
case 3:
babyArrow.x += Note.swagWidth * 3;
babyArrow.animation.add('static', [3]);
babyArrow.animation.add('pressed', [7, 11], 12, false);
babyArrow.animation.add('confirm', [15, 19], 24, false);
}
2021-01-25 04:18:44 -05:00
default:
2021-02-08 16:34:48 -05:00
babyArrow.frames = Paths.getSparrowAtlas('NOTE_assets');
2021-01-25 04:18:44 -05:00
babyArrow.animation.addByPrefix('green', 'arrowUP');
babyArrow.animation.addByPrefix('blue', 'arrowDOWN');
babyArrow.animation.addByPrefix('purple', 'arrowLEFT');
babyArrow.animation.addByPrefix('red', 'arrowRIGHT');
babyArrow.antialiasing = true;
babyArrow.setGraphicSize(Std.int(babyArrow.width * 0.7));
switch (Math.abs(i))
{
2021-02-13 17:39:31 -05:00
case 0:
babyArrow.x += Note.swagWidth * 0;
2021-03-20 01:03:42 -04:00
babyArrow.animation.addByPrefix('static', 'arrow static instance 1');
2021-02-13 17:39:31 -05:00
babyArrow.animation.addByPrefix('pressed', 'left press', 24, false);
babyArrow.animation.addByPrefix('confirm', 'left confirm', 24, false);
case 1:
babyArrow.x += Note.swagWidth * 1;
2021-03-20 01:03:42 -04:00
babyArrow.animation.addByPrefix('static', 'arrow static instance 2');
2021-02-13 17:39:31 -05:00
babyArrow.animation.addByPrefix('pressed', 'down press', 24, false);
babyArrow.animation.addByPrefix('confirm', 'down confirm', 24, false);
2021-01-25 04:18:44 -05:00
case 2:
babyArrow.x += Note.swagWidth * 2;
2021-03-20 01:03:42 -04:00
babyArrow.animation.addByPrefix('static', 'arrow static instance 4');
2021-01-25 04:18:44 -05:00
babyArrow.animation.addByPrefix('pressed', 'up press', 24, false);
babyArrow.animation.addByPrefix('confirm', 'up confirm', 24, false);
case 3:
babyArrow.x += Note.swagWidth * 3;
2021-03-20 01:03:42 -04:00
babyArrow.animation.addByPrefix('static', 'arrow static instance 3');
2021-01-25 04:18:44 -05:00
babyArrow.animation.addByPrefix('pressed', 'right press', 24, false);
babyArrow.animation.addByPrefix('confirm', 'right confirm', 24, false);
}
}
2020-10-04 04:38:21 -04:00
babyArrow.updateHitbox();
2021-01-25 04:18:44 -05:00
babyArrow.scrollFactor.set();
2020-10-04 04:38:21 -04:00
2021-02-12 01:20:20 -05:00
if (!isStoryMode)
{
babyArrow.y -= 10;
babyArrow.alpha = 0;
FlxTween.tween(babyArrow, {y: babyArrow.y + 10, alpha: 1}, 1, {ease: FlxEase.circOut, startDelay: 0.5 + (0.2 * i)});
}
2020-10-05 14:24:51 -04:00
2020-10-13 22:12:31 -04:00
babyArrow.ID = i;
2020-10-04 04:38:21 -04:00
if (player == 1)
{
playerStrums.add(babyArrow);
}
babyArrow.animation.play('static');
babyArrow.x += 50;
babyArrow.x += ((FlxG.width / 2) * player);
strumLineNotes.add(babyArrow);
}
}
2020-10-31 21:11:14 -04:00
function tweenCamIn():Void
{
FlxTween.tween(FlxG.camera, {zoom: 1.3}, (Conductor.stepCrochet * 4 / 1000), {ease: FlxEase.elasticInOut});
}
2020-10-09 17:24:20 -04:00
override function openSubState(SubState:FlxSubState)
{
if (paused)
{
if (FlxG.sound.music != null)
{
FlxG.sound.music.pause();
vocals.pause();
}
if (!startTimer.finished)
startTimer.active = false;
2020-10-09 17:24:20 -04:00
}
super.openSubState(SubState);
}
override function closeSubState()
{
if (paused)
{
if (FlxG.sound.music != null && !startingSong)
{
2020-12-13 01:42:48 -05:00
resyncVocals();
}
if (!startTimer.finished)
startTimer.active = true;
2020-10-09 17:24:20 -04:00
paused = false;
2021-02-27 18:23:50 -05:00
2021-03-22 10:09:46 -04:00
#if discord_rpc
2021-02-27 18:23:50 -05:00
if (startTimer.finished)
{
DiscordClient.changePresence(detailsText, SONG.song + " (" + storyDifficultyText + ")", iconRPC, true, songLength - Conductor.songPosition);
}
else
{
DiscordClient.changePresence(detailsText, SONG.song + " (" + storyDifficultyText + ")", iconRPC);
}
#end
2020-10-09 17:24:20 -04:00
}
super.closeSubState();
}
2021-03-22 10:09:46 -04:00
#if discord_rpc
2021-02-27 18:49:53 -05:00
override public function onFocus():Void
{
if (health > 0 && !paused)
{
if (Conductor.songPosition > 0.0)
{
DiscordClient.changePresence(detailsText, SONG.song + " (" + storyDifficultyText + ")", iconRPC, true, songLength - Conductor.songPosition);
}
else
{
DiscordClient.changePresence(detailsText, SONG.song + " (" + storyDifficultyText + ")", iconRPC);
}
}
super.onFocus();
}
2021-02-27 18:49:53 -05:00
override public function onFocusLost():Void
{
if (health > 0 && !paused)
{
DiscordClient.changePresence(detailsPausedText, SONG.song + " (" + storyDifficultyText + ")", iconRPC);
}
super.onFocusLost();
}
2021-03-22 10:09:46 -04:00
#end
2021-02-27 18:49:53 -05:00
2020-12-13 01:42:48 -05:00
function resyncVocals():Void
{
if (_exiting)
return ;
2020-12-13 01:42:48 -05:00
vocals.pause();
2020-12-13 01:42:48 -05:00
FlxG.sound.music.play();
Conductor.songPosition = FlxG.sound.music.time;
if (vocalsFinished)
return ;
2020-12-13 01:42:48 -05:00
vocals.time = Conductor.songPosition;
vocals.play();
}
2020-10-09 17:24:20 -04:00
private var paused:Bool = false;
2020-10-23 19:12:38 -04:00
var startedCountdown:Bool = false;
2020-11-24 22:53:48 -05:00
var canPause:Bool = true;
2020-10-09 17:24:20 -04:00
2020-10-03 02:50:15 -04:00
override public function update(elapsed:Float)
{
// makes the lerp non-dependant on the framerate
2021-04-04 13:17:46 -04:00
FlxG.camera.followLerp = CoolUtil.camLerpShit(0.04);
2020-12-22 20:55:03 -05:00
#if !debug
perfectMode = false;
#end
if (FlxG.keys.justPressed.NINE)
2021-03-18 21:08:44 -04:00
iconP1.swapOldIcon();
2020-12-22 20:55:03 -05:00
// do this BEFORE super.update() so songPosition is accurate
if (startingSong)
{
if (startedCountdown)
{
Conductor.songPosition += FlxG.elapsed * 1000;
if (Conductor.songPosition >= 0)
startSong();
}
}
else
{
// Conductor.songPosition = FlxG.sound.music.time;
Conductor.songPosition += FlxG.elapsed * 1000;
if (!paused)
{
songTime += FlxG.game.ticks - previousFrameTime;
previousFrameTime = FlxG.game.ticks;
// Interpolation type beat
if (Conductor.lastSongPos != Conductor.songPosition)
{
songTime = (songTime + Conductor.songPosition) / 2;
Conductor.lastSongPos = Conductor.songPosition;
// Conductor.songPosition += FlxG.elapsed * 1000;
// trace('MISSED FRAME');
}
}
// Conductor.lastSongPos = FlxG.sound.music.time;
}
2020-12-10 18:23:53 -05:00
switch (curStage)
{
case 'philly':
if (trainMoving)
{
trainFrameTiming += elapsed;
if (trainFrameTiming >= 1 / 24)
{
updateTrainPos();
trainFrameTiming = 0;
}
}
2020-12-13 01:08:21 -05:00
// phillyCityLights.members[curLight].alpha -= (Conductor.crochet / 1000) * FlxG.elapsed;
2020-12-10 18:23:53 -05:00
}
2020-10-03 02:50:15 -04:00
super.update(elapsed);
2020-11-24 22:53:48 -05:00
scoreTxt.text = "Score:" + songScore;
if (controls.PAUSE && startedCountdown && canPause)
2020-10-09 17:24:20 -04:00
{
persistentUpdate = false;
persistentDraw = true;
paused = true;
// 1 / 1000 chance for Gitaroo Man easter egg
if (FlxG.random.bool(0.1))
{
// gitaroo man easter egg
FlxG.switchState(new GitarooPause());
}
else
2021-03-13 22:41:12 -05:00
{
var boyfriendPos = boyfriend.getScreenPosition();
var pauseSubState = new PauseSubState(boyfriendPos.x, boyfriendPos.y);
openSubState(pauseSubState);
pauseSubState.camera = camHUD;
boyfriendPos.put();
}
2021-03-22 10:09:46 -04:00
#if discord_rpc
2021-02-27 18:23:50 -05:00
DiscordClient.changePresence(detailsPausedText, SONG.song + " (" + storyDifficultyText + ")", iconRPC);
#end
2020-10-09 17:24:20 -04:00
}
2020-11-06 21:17:27 -05:00
if (FlxG.keys.justPressed.SEVEN)
2020-10-13 21:44:07 -04:00
{
2020-11-06 21:17:27 -05:00
FlxG.switchState(new ChartingState());
2021-03-22 10:09:46 -04:00
#if discord_rpc
DiscordClient.changePresence("Chart Editor", null, null, true);
#end
2020-10-13 21:44:07 -04:00
}
2020-10-14 04:30:54 -04:00
// FlxG.watch.addQuick('VOL', vocals.amplitudeLeft);
// FlxG.watch.addQuick('VOLRight', vocals.amplitudeRight);
2020-10-09 23:22:07 -04:00
2021-03-24 23:39:19 -04:00
iconP1.setGraphicSize(Std.int(FlxMath.lerp(150, iconP1.width, 0.85)));
iconP2.setGraphicSize(Std.int(FlxMath.lerp(150, iconP2.width, 0.85)));
2020-12-24 18:24:11 -05:00
iconP1.updateHitbox();
iconP2.updateHitbox();
2021-01-05 07:53:42 -05:00
2020-12-24 18:24:11 -05:00
var iconOffset:Int = 26;
iconP1.x = healthBar.x + (healthBar.width * (FlxMath.remapToRange(healthBar.percent, 0, 100, 100, 0) * 0.01) - iconOffset);
iconP2.x = healthBar.x + (healthBar.width * (FlxMath.remapToRange(healthBar.percent, 0, 100, 100, 0) * 0.01)) - (iconP2.width - iconOffset);
2020-10-05 16:32:41 -04:00
2020-11-01 14:16:22 -05:00
if (health > 2)
health = 2;
2020-10-24 05:19:13 -04:00
if (healthBar.percent < 20)
2020-12-24 18:24:11 -05:00
iconP1.animation.curAnim.curFrame = 1;
2020-10-05 18:29:59 -04:00
else
2020-12-24 18:24:11 -05:00
iconP1.animation.curAnim.curFrame = 0;
2021-01-13 22:38:31 -05:00
if (healthBar.percent > 80)
2021-01-14 23:33:12 -05:00
iconP2.animation.curAnim.curFrame = 1;
2021-01-01 00:39:58 -05:00
else
2021-01-14 23:33:12 -05:00
iconP2.animation.curAnim.curFrame = 0;
2021-01-05 07:53:42 -05:00
2020-10-18 20:59:53 -04:00
/* if (FlxG.keys.justPressed.NINE)
FlxG.switchState(new Charting()); */
2020-11-02 01:46:37 -05:00
#if debug
if (FlxG.keys.justPressed.EIGHT)
2020-12-09 17:36:31 -05:00
FlxG.switchState(new AnimationDebug(SONG.player2));
2020-11-02 01:46:37 -05:00
#end
2020-10-04 02:42:58 -04:00
2020-10-18 03:27:39 -04:00
if (generatedMusic && PlayState.SONG.notes[Std.int(curStep / 16)] != null)
2020-10-03 15:32:15 -04:00
{
2021-03-24 23:39:19 -04:00
cameraRightSide = PlayState.SONG.notes[Std.int(curStep / 16)].mustHitSection;
2020-10-18 03:27:39 -04:00
cameraMovement();
2020-10-03 02:50:15 -04:00
}
2020-10-05 05:48:30 -04:00
if (camZooming)
{
2020-12-26 21:46:22 -05:00
FlxG.camera.zoom = FlxMath.lerp(defaultCamZoom, FlxG.camera.zoom, 0.95);
2020-11-02 01:46:37 -05:00
camHUD.zoom = FlxMath.lerp(1, camHUD.zoom, 0.95);
2020-10-05 05:48:30 -04:00
}
FlxG.watch.addQuick("beatShit", curBeat);
FlxG.watch.addQuick("stepShit", curStep);
2020-10-05 08:55:39 -04:00
if (curSong == 'Fresh')
2020-10-05 05:48:30 -04:00
{
switch (curBeat)
2020-10-05 08:55:39 -04:00
{
case 16:
camZooming = true;
gfSpeed = 2;
case 48:
gfSpeed = 1;
case 80:
gfSpeed = 2;
case 112:
gfSpeed = 1;
2020-10-05 18:29:59 -04:00
case 163:
2020-10-31 21:11:14 -04:00
// FlxG.sound.music.stop();
// FlxG.switchState(new TitleState());
2020-10-05 18:29:59 -04:00
}
}
if (curSong == 'Bopeebo')
{
switch (curBeat)
2020-10-05 18:29:59 -04:00
{
case 128, 129, 130:
2020-12-13 01:42:48 -05:00
vocals.volume = 0;
2020-10-31 21:11:14 -04:00
// FlxG.sound.music.stop();
// FlxG.switchState(new PlayState());
2020-10-05 08:55:39 -04:00
}
2020-10-05 05:48:30 -04:00
}
// better streaming of shit
if (!inCutscene && !_exiting)
2020-12-02 12:28:28 -05:00
{
// RESET = Quick Game Over Screen
if (controls.RESET)
{
health = 0;
trace("RESET = True");
}
#if CAN_CHEAT // brandon's a pussy
if (controls.CHEAT)
{
health += 1;
trace("User is cheating!");
}
#end
if (health <= 0 && !practiceMode)
{
boyfriend.stunned = true;
2020-10-30 19:47:19 -04:00
persistentUpdate = false;
persistentDraw = false;
paused = true;
2020-10-30 19:47:19 -04:00
vocals.stop();
FlxG.sound.music.stop();
2020-10-30 19:47:19 -04:00
deathCounter += 1;
2021-03-04 14:30:35 -05:00
openSubState(new GameOverSubstate(boyfriend.getScreenPosition().x, boyfriend.getScreenPosition().y));
2020-10-30 19:47:19 -04:00
// FlxG.switchState(new GameOverState(boyfriend.getScreenPosition().x, boyfriend.getScreenPosition().y));
#if discord_rpc
// Game Over doesn't get his own variable because it's only used here
DiscordClient.changePresence("Game Over - " + detailsText, SONG.song + " (" + storyDifficultyText + ")", iconRPC);
#end
}
2020-10-05 18:29:59 -04:00
}
2021-03-31 13:11:05 -04:00
while (unspawnNotes[0] != null && unspawnNotes[0].strumTime - Conductor.songPosition < 1800 / SONG.speed)
2020-10-05 05:48:30 -04:00
{
var dunceNote:Note = unspawnNotes[0];
notes.add(dunceNote);
2020-10-05 06:25:14 -04:00
var index:Int = unspawnNotes.indexOf(dunceNote);
2021-04-01 22:28:20 -04:00
unspawnNotes.shift();
2020-10-05 05:48:30 -04:00
}
2020-10-03 02:50:15 -04:00
2020-10-05 14:24:51 -04:00
if (generatedMusic)
2020-10-03 02:50:15 -04:00
{
2020-10-05 14:24:51 -04:00
notes.forEachAlive(function(daNote:Note)
2020-10-04 02:42:58 -04:00
{
2020-10-05 14:24:51 -04:00
if (daNote.y > FlxG.height)
2020-10-04 02:42:58 -04:00
{
2020-10-05 14:24:51 -04:00
daNote.active = false;
daNote.visible = false;
}
else
{
daNote.visible = true;
daNote.active = true;
2020-10-04 02:42:58 -04:00
}
var strumLineMid = strumLine.y + Note.swagWidth / 2;
2021-03-30 18:10:15 -04:00
if (PreferencesMenu.getPref('downscroll'))
{
2021-03-30 18:10:15 -04:00
daNote.y = (strumLine.y + (Conductor.songPosition - daNote.strumTime) * (0.45 * FlxMath.roundDecimal(SONG.speed, 2)));
2021-03-31 13:11:05 -04:00
if (daNote.isSustainNote)
{
2021-03-31 13:11:05 -04:00
if (daNote.animation.curAnim.name.endsWith("end") && daNote.prevNote != null)
daNote.y += daNote.prevNote.height;
else
daNote.y += daNote.height / daNote.scale.y;
2021-03-31 13:11:05 -04:00
if ((!daNote.mustPress || (daNote.wasGoodHit || (daNote.prevNote.wasGoodHit && !daNote.canBeHit)))
2021-03-31 15:41:45 -04:00
&& daNote.y - daNote.offset.y * daNote.scale.y + daNote.height >= strumLineMid)
2021-03-31 13:11:05 -04:00
{
// div by scale because cliprect is affected by scale i THINK
var swagRect:FlxRect = new FlxRect(0, 0, daNote.width / daNote.scale.x, daNote.height / daNote.scale.y);
swagRect.height = (strumLineMid - daNote.y) / daNote.scale.y;
swagRect.y = daNote.height / daNote.scale.y - swagRect.height;
daNote.clipRect = swagRect;
}
}
}
2021-03-30 18:10:15 -04:00
else
{
2021-03-30 18:10:15 -04:00
daNote.y = (strumLine.y - (Conductor.songPosition - daNote.strumTime) * (0.45 * FlxMath.roundDecimal(SONG.speed, 2)));
2021-02-13 17:39:31 -05:00
2021-03-31 00:25:41 -04:00
if (daNote.isSustainNote
&& (!daNote.mustPress || (daNote.wasGoodHit || (daNote.prevNote.wasGoodHit && !daNote.canBeHit)))
&& daNote.y + daNote.offset.y * daNote.scale.y <= strumLineMid)
{
var swagRect:FlxRect = new FlxRect(0, 0, daNote.width / daNote.scale.x, daNote.height / daNote.scale.y);
2021-02-13 17:39:31 -05:00
swagRect.y = (strumLineMid - daNote.y) / daNote.scale.y;
swagRect.height -= swagRect.y;
daNote.clipRect = swagRect;
}
2021-02-13 17:39:31 -05:00
}
2020-10-05 14:24:51 -04:00
if (!daNote.mustPress && daNote.wasGoodHit)
{
2020-11-02 01:46:37 -05:00
if (SONG.song != 'Tutorial')
camZooming = true;
2021-01-17 04:16:02 -05:00
var altAnim:String = "";
if (SONG.notes[Math.floor(curStep / 16)] != null)
{
if (SONG.notes[Math.floor(curStep / 16)].altAnim)
altAnim = '-alt';
}
2020-10-05 14:24:51 -04:00
switch (Math.abs(daNote.noteData))
{
2021-02-13 17:39:31 -05:00
case 0:
dad.playAnim('singLEFT' + altAnim, true);
case 1:
dad.playAnim('singDOWN' + altAnim, true);
2020-10-05 14:24:51 -04:00
case 2:
2021-01-17 04:16:02 -05:00
dad.playAnim('singUP' + altAnim, true);
2020-10-05 14:24:51 -04:00
case 3:
2021-01-17 04:16:02 -05:00
dad.playAnim('singRIGHT' + altAnim, true);
2020-10-05 14:24:51 -04:00
}
2020-10-04 02:42:58 -04:00
2020-11-11 05:00:13 -05:00
dad.holdTimer = 0;
2020-10-30 19:47:19 -04:00
if (SONG.needsVoices)
vocals.volume = 1;
2020-10-05 14:24:51 -04:00
daNote.kill();
notes.remove(daNote, true);
daNote.destroy();
}
2020-10-05 01:13:12 -04:00
// WIP interpolation shit? Need to fix the pause issue
// daNote.y = (strumLine.y - (songTime - daNote.strumTime) * (0.45 * PlayState.SONG.speed));
2020-10-05 06:25:14 -04:00
2021-03-30 18:10:15 -04:00
var noteMiss:Bool = daNote.y < -daNote.height;
if (PreferencesMenu.getPref('downscroll'))
noteMiss = daNote.y > FlxG.height;
if (noteMiss)
2020-10-05 14:24:51 -04:00
{
if (daNote.tooLate || !daNote.wasGoodHit)
2020-10-05 18:29:59 -04:00
{
health -= 0.0475;
vocals.volume = 0;
2020-10-05 18:29:59 -04:00
}
2020-10-05 06:25:14 -04:00
daNote.active = false;
daNote.visible = false;
2020-10-05 06:25:14 -04:00
daNote.kill();
notes.remove(daNote, true);
daNote.destroy();
2020-10-05 14:24:51 -04:00
}
});
}
2020-10-05 06:25:14 -04:00
2021-02-02 02:35:35 -05:00
if (!inCutscene)
keyShit();
2021-01-20 04:03:49 -05:00
2021-02-02 04:13:28 -05:00
#if debug
if (FlxG.keys.justPressed.ONE)
endSong();
#end
2020-10-03 13:36:39 -04:00
}
2020-10-31 21:11:14 -04:00
function endSong():Void
{
2021-03-04 14:30:35 -05:00
deathCounter = 0;
2020-11-24 22:53:48 -05:00
canPause = false;
2021-01-20 04:03:49 -05:00
FlxG.sound.music.volume = 0;
vocals.volume = 0;
2020-12-04 12:32:35 -05:00
if (SONG.validScore)
{
Highscore.saveScore(SONG.song, songScore, storyDifficulty);
}
2020-11-01 04:55:02 -05:00
2020-10-31 21:11:14 -04:00
if (isStoryMode)
{
2020-11-06 21:17:27 -05:00
campaignScore += songScore;
2020-10-31 21:11:14 -04:00
storyPlaylist.remove(storyPlaylist[0]);
if (storyPlaylist.length <= 0)
{
2021-02-08 16:34:48 -05:00
FlxG.sound.playMusic(Paths.music('freakyMenu'));
2020-11-01 14:16:22 -05:00
2021-02-12 01:20:20 -05:00
transIn = FlxTransitionableState.defaultTransIn;
transOut = FlxTransitionableState.defaultTransOut;
2020-11-01 14:16:22 -05:00
FlxG.switchState(new StoryMenuState());
2020-10-31 21:11:14 -04:00
2020-12-04 12:36:28 -05:00
// if ()
2020-12-11 17:22:22 -05:00
StoryMenuState.weekUnlocked[Std.int(Math.min(storyWeek + 1, StoryMenuState.weekUnlocked.length - 1))] = true;
2020-11-01 14:16:22 -05:00
2020-12-04 12:36:28 -05:00
if (SONG.validScore)
{
NGio.unlockMedal(60961);
Highscore.saveWeekScore(storyWeek, campaignScore, storyDifficulty);
}
2020-11-01 04:55:02 -05:00
2020-11-01 14:16:22 -05:00
FlxG.save.data.weekUnlocked = StoryMenuState.weekUnlocked;
FlxG.save.flush();
2020-10-31 21:11:14 -04:00
}
else
{
var difficulty:String = "";
if (storyDifficulty == 0)
difficulty = '-easy';
if (storyDifficulty == 2)
2020-11-10 13:08:18 -05:00
difficulty = '-hard';
2020-10-31 21:11:14 -04:00
2020-11-07 16:59:25 -05:00
trace('LOADING NEXT SONG');
trace(PlayState.storyPlaylist[0].toLowerCase() + difficulty);
2021-01-20 04:03:49 -05:00
if (SONG.song.toLowerCase() == 'eggnog')
{
var blackShit:FlxSprite = new FlxSprite(-FlxG.width * FlxG.camera.zoom,
-FlxG.height * FlxG.camera.zoom).makeGraphic(FlxG.width * 3, FlxG.height * 3, FlxColor.BLACK);
blackShit.scrollFactor.set();
add(blackShit);
camHUD.visible = false;
2021-02-08 16:34:48 -05:00
FlxG.sound.play(Paths.sound('Lights_Shut_off'));
2021-01-20 04:03:49 -05:00
}
2021-02-12 01:20:20 -05:00
FlxTransitionableState.skipNextTransIn = true;
FlxTransitionableState.skipNextTransOut = true;
prevCamFollow = camFollow;
2021-02-02 04:13:28 -05:00
2020-10-31 21:11:14 -04:00
PlayState.SONG = Song.loadFromJson(PlayState.storyPlaylist[0].toLowerCase() + difficulty, PlayState.storyPlaylist[0]);
2020-12-17 15:03:33 -05:00
FlxG.sound.music.stop();
2021-01-20 04:03:49 -05:00
LoadingState.loadAndSwitchState(new PlayState());
2020-10-31 21:11:14 -04:00
}
}
else
{
2020-12-26 21:46:22 -05:00
trace('WENT BACK TO FREEPLAY??');
2020-10-31 21:11:14 -04:00
FlxG.switchState(new FreeplayState());
}
}
var endingSong:Bool = false;
2021-03-26 03:51:39 -04:00
private function popUpScore(strumtime:Float, daNote:Note):Void
2020-10-03 15:32:15 -04:00
{
2020-10-18 20:59:53 -04:00
var noteDiff:Float = Math.abs(strumtime - Conductor.songPosition);
// boyfriend.playAnim('hey');
2020-10-30 19:47:19 -04:00
vocals.volume = 1;
2020-10-04 02:42:58 -04:00
2020-10-05 10:03:38 -04:00
var placement:String = Std.string(combo);
2020-10-03 15:32:15 -04:00
var coolText:FlxText = new FlxText(0, 0, 0, placement, 32);
coolText.screenCenter();
2020-10-18 20:59:53 -04:00
coolText.x = FlxG.width * 0.55;
2020-10-05 10:03:38 -04:00
//
var rating:FlxSprite = new FlxSprite();
2020-11-01 14:16:22 -05:00
var score:Int = 350;
2020-10-05 10:03:38 -04:00
2020-10-18 20:59:53 -04:00
var daRating:String = "sick";
2020-10-05 10:03:38 -04:00
2021-03-26 03:51:39 -04:00
var isSick:Bool = true;
2020-10-18 20:59:53 -04:00
if (noteDiff > Conductor.safeZoneOffset * 0.9)
{
daRating = 'shit';
2020-11-01 14:16:22 -05:00
score = 50;
2021-03-26 03:51:39 -04:00
isSick = false; // shitty copypaste on this literally just because im lazy and tired lol!
2020-10-18 20:59:53 -04:00
}
else if (noteDiff > Conductor.safeZoneOffset * 0.75)
{
2020-10-05 10:03:38 -04:00
daRating = 'bad';
2020-11-01 14:16:22 -05:00
score = 100;
2021-03-26 03:51:39 -04:00
isSick = false;
2020-10-18 20:59:53 -04:00
}
else if (noteDiff > Conductor.safeZoneOffset * 0.2)
{
daRating = 'good';
2020-11-01 14:16:22 -05:00
score = 200;
2021-03-26 03:51:39 -04:00
isSick = false;
}
if (isSick)
{
var noteSplash:NoteSplash = new NoteSplash(daNote.x, daNote.y, daNote.noteData);
add(noteSplash);
noteSplash.cameras = [camHUD];
2020-10-18 20:59:53 -04:00
}
2020-11-01 14:16:22 -05:00
songScore += score;
2020-10-18 20:59:53 -04:00
/* if (combo > 60)
daRating = 'sick';
else if (combo > 12)
daRating = 'good'
else if (combo > 4)
daRating = 'bad';
*/
2021-01-25 05:04:31 -05:00
var pixelShitPart1:String = "";
var pixelShitPart2:String = '';
2021-02-02 00:48:22 -05:00
if (curStage.startsWith('school'))
2021-01-25 05:04:31 -05:00
{
pixelShitPart1 = 'weeb/pixelUI/';
pixelShitPart2 = '-pixel';
}
rating.loadGraphic(Paths.image(pixelShitPart1 + daRating + pixelShitPart2));
2020-10-05 10:03:38 -04:00
rating.screenCenter();
rating.x = coolText.x - 40;
rating.y -= 60;
rating.acceleration.y = 550;
rating.velocity.y -= FlxG.random.int(140, 175);
rating.velocity.x -= FlxG.random.int(0, 10);
2021-02-08 16:34:48 -05:00
var comboSpr:FlxSprite = new FlxSprite().loadGraphic(Paths.image(pixelShitPart1 + 'combo' + pixelShitPart2));
2020-10-05 10:03:38 -04:00
comboSpr.screenCenter();
comboSpr.x = coolText.x;
comboSpr.acceleration.y = 600;
comboSpr.velocity.y -= 150;
2021-01-25 05:04:31 -05:00
2020-10-05 10:03:38 -04:00
comboSpr.velocity.x += FlxG.random.int(1, 10);
add(rating);
2021-02-02 00:48:22 -05:00
if (!curStage.startsWith('school'))
2021-01-25 05:04:31 -05:00
{
rating.setGraphicSize(Std.int(rating.width * 0.7));
rating.antialiasing = true;
comboSpr.setGraphicSize(Std.int(comboSpr.width * 0.7));
comboSpr.antialiasing = true;
}
else
{
rating.setGraphicSize(Std.int(rating.width * daPixelZoom * 0.7));
comboSpr.setGraphicSize(Std.int(comboSpr.width * daPixelZoom * 0.7));
}
comboSpr.updateHitbox();
rating.updateHitbox();
2020-10-05 10:03:38 -04:00
var seperatedScore:Array<Int> = [];
seperatedScore.push(Math.floor(combo / 100));
seperatedScore.push(Math.floor((combo - (seperatedScore[0] * 100)) / 10));
seperatedScore.push(combo % 10);
var daLoop:Int = 0;
for (i in seperatedScore)
{
2021-02-08 16:34:48 -05:00
var numScore:FlxSprite = new FlxSprite().loadGraphic(Paths.image(pixelShitPart1 + 'num' + Std.int(i) + pixelShitPart2));
2020-10-05 10:03:38 -04:00
numScore.screenCenter();
2020-10-05 16:32:41 -04:00
numScore.x = coolText.x + (43 * daLoop) - 90;
2020-10-05 10:03:38 -04:00
numScore.y += 80;
2021-01-25 05:04:31 -05:00
2021-02-02 00:48:22 -05:00
if (!curStage.startsWith('school'))
2021-01-25 05:04:31 -05:00
{
numScore.antialiasing = true;
numScore.setGraphicSize(Std.int(numScore.width * 0.5));
}
else
{
numScore.setGraphicSize(Std.int(numScore.width * daPixelZoom));
}
2020-10-05 10:03:38 -04:00
numScore.updateHitbox();
2021-01-25 05:04:31 -05:00
2020-10-05 10:03:38 -04:00
numScore.acceleration.y = FlxG.random.int(200, 300);
numScore.velocity.y -= FlxG.random.int(140, 160);
numScore.velocity.x = FlxG.random.float(-5, 5);
2020-11-01 14:16:22 -05:00
if (combo >= 10 || combo == 0)
add(numScore);
2020-10-05 10:03:38 -04:00
FlxTween.tween(numScore, {alpha: 0}, 0.2, {
onComplete: function(tween:FlxTween)
{
numScore.destroy();
},
startDelay: Conductor.crochet * 0.002
});
2020-10-03 15:32:15 -04:00
2020-10-05 10:03:38 -04:00
daLoop++;
}
2020-10-24 05:19:13 -04:00
/*
trace(combo);
trace(seperatedScore);
*/
2020-10-05 10:03:38 -04:00
coolText.text = Std.string(seperatedScore);
// add(coolText);
FlxTween.tween(rating, {alpha: 0}, 0.2, {
startDelay: Conductor.crochet * 0.001
});
FlxTween.tween(comboSpr, {alpha: 0}, 0.2, {
2020-10-03 15:32:15 -04:00
onComplete: function(tween:FlxTween)
{
2020-10-05 06:25:14 -04:00
coolText.destroy();
2020-10-05 10:03:38 -04:00
comboSpr.destroy();
rating.destroy();
2020-10-03 15:32:15 -04:00
},
startDelay: Conductor.crochet * 0.001
});
curSection += 1;
}
2021-03-24 23:39:19 -04:00
var cameraRightSide:Bool = false;
function cameraMovement()
{
2021-03-24 23:39:19 -04:00
if (camFollow.x != dad.getMidpoint().x + 150 && !cameraRightSide)
{
camFollow.setPosition(dad.getMidpoint().x + 150, dad.getMidpoint().y - 100);
// camFollow.setPosition(lucky.getMidpoint().x - 120, lucky.getMidpoint().y + 210);
switch (dad.curCharacter)
{
case 'mom':
camFollow.y = dad.getMidpoint().y;
case 'senpai':
camFollow.y = dad.getMidpoint().y - 430;
camFollow.x = dad.getMidpoint().x - 100;
case 'senpai-angry':
camFollow.y = dad.getMidpoint().y - 430;
camFollow.x = dad.getMidpoint().x - 100;
}
if (dad.curCharacter == 'mom')
vocals.volume = 1;
if (SONG.song.toLowerCase() == 'tutorial')
{
tweenCamIn();
}
}
2021-03-24 23:39:19 -04:00
if (cameraRightSide && camFollow.x != boyfriend.getMidpoint().x - 100)
{
camFollow.setPosition(boyfriend.getMidpoint().x - 100, boyfriend.getMidpoint().y - 100);
switch (curStage)
{
case 'limo':
camFollow.x = boyfriend.getMidpoint().x - 300;
case 'mall':
camFollow.y = boyfriend.getMidpoint().y - 200;
case 'school':
camFollow.x = boyfriend.getMidpoint().x - 200;
camFollow.y = boyfriend.getMidpoint().y - 200;
case 'schoolEvil':
camFollow.x = boyfriend.getMidpoint().x - 200;
camFollow.y = boyfriend.getMidpoint().y - 200;
}
if (SONG.song.toLowerCase() == 'tutorial')
{
FlxTween.tween(FlxG.camera, {zoom: 1}, (Conductor.stepCrochet * 4 / 1000), {ease: FlxEase.elasticInOut});
}
}
}
2020-10-05 06:53:10 -04:00
private function keyShit():Void
2020-10-03 13:36:39 -04:00
{
// control arrays, order L D R U
var holdArray:Array<Bool> = [controls.NOTE_LEFT, controls.NOTE_DOWN, controls.NOTE_UP, controls.NOTE_RIGHT];
2021-03-30 16:58:05 -04:00
var pressArray:Array<Bool> = [
controls.NOTE_LEFT_P,
controls.NOTE_DOWN_P,
controls.NOTE_UP_P,
controls.NOTE_RIGHT_P
];
var releaseArray:Array<Bool> = [
controls.NOTE_LEFT_R,
controls.NOTE_DOWN_R,
controls.NOTE_UP_R,
controls.NOTE_RIGHT_R
];
2020-10-21 19:33:43 -04:00
// HOLDS, check for sustain notes
if (holdArray.contains(true) && /*!boyfriend.stunned && */ generatedMusic)
2020-10-03 13:36:39 -04:00
{
notes.forEachAlive(function(daNote:Note)
{
if (daNote.isSustainNote && daNote.canBeHit && daNote.mustPress && holdArray[daNote.noteData])
goodNoteHit(daNote);
});
}
// PRESSES, check for note hits
if (pressArray.contains(true) && /*!boyfriend.stunned && */ generatedMusic)
{
2020-11-11 05:00:13 -05:00
boyfriend.holdTimer = 0;
var possibleNotes:Array<Note> = []; // notes that can be hit
var directionList:Array<Int> = []; // directions that can be hit
var dumbNotes:Array<Note> = []; // notes to kill later
2021-01-17 21:23:40 -05:00
2020-10-05 03:49:53 -04:00
notes.forEachAlive(function(daNote:Note)
2020-10-03 13:36:39 -04:00
{
if (daNote.canBeHit && daNote.mustPress && !daNote.tooLate && !daNote.wasGoodHit)
2020-10-04 23:29:35 -04:00
{
if (directionList.contains(daNote.noteData))
2021-01-17 21:23:40 -05:00
{
2021-01-17 21:36:23 -05:00
for (coolNote in possibleNotes)
2021-01-17 21:23:40 -05:00
{
if (coolNote.noteData == daNote.noteData && Math.abs(daNote.strumTime - coolNote.strumTime) < 10)
2021-03-30 16:58:05 -04:00
{ // if it's the same note twice at < 10ms distance, just delete it
// EXCEPT u cant delete it in this loop cuz it fucks with the collection lol
dumbNotes.push(daNote);
break;
}
else if (coolNote.noteData == daNote.noteData && daNote.strumTime < coolNote.strumTime)
2021-03-30 16:58:05 -04:00
{ // if daNote is earlier than existing note (coolNote), replace
possibleNotes.remove(coolNote);
possibleNotes.push(daNote);
break;
2021-01-17 21:36:23 -05:00
}
2021-01-17 21:23:40 -05:00
}
}
2021-01-19 21:09:47 -05:00
else
{
possibleNotes.push(daNote);
directionList.push(daNote.noteData);
2021-01-19 21:09:47 -05:00
}
2021-01-17 21:36:23 -05:00
}
});
2021-03-04 14:30:35 -05:00
for (note in dumbNotes)
2020-10-04 23:29:35 -04:00
{
2021-03-30 16:58:05 -04:00
FlxG.log.add("killing dumb ass note at " + note.strumTime);
note.kill();
notes.remove(note, true);
note.destroy();
2020-10-04 23:29:35 -04:00
}
2020-10-04 17:44:52 -04:00
possibleNotes.sort((a, b) -> Std.int(a.strumTime - b.strumTime));
if (perfectMode)
goodNoteHit(possibleNotes[0]);
else if (possibleNotes.length > 0)
2020-10-05 03:49:53 -04:00
{
for (shit in 0...pressArray.length)
2021-03-30 16:58:05 -04:00
{ // if a direction is hit that shouldn't be
if (pressArray[shit] && !directionList.contains(shit))
badNoteHit();
}
for (coolNote in possibleNotes)
2020-10-05 03:49:53 -04:00
{
if (pressArray[coolNote.noteData])
goodNoteHit(coolNote);
2020-10-05 03:49:53 -04:00
}
}
else
{
badNoteHit();
}
2020-10-05 03:49:53 -04:00
}
if (boyfriend.holdTimer > Conductor.stepCrochet * 4 * 0.001 && !holdArray.contains(true))
2020-10-23 19:12:38 -04:00
{
2020-11-11 05:00:13 -05:00
if (boyfriend.animation.curAnim.name.startsWith('sing') && !boyfriend.animation.curAnim.name.endsWith('miss'))
2020-10-23 19:12:38 -04:00
{
boyfriend.playAnim('idle');
}
}
2020-10-04 17:44:52 -04:00
playerStrums.forEach(function(spr:FlxSprite)
{
if (pressArray[spr.ID] && spr.animation.curAnim.name != 'confirm')
spr.animation.play('pressed');
if (!holdArray[spr.ID])
spr.animation.play('static');
2020-10-05 06:53:10 -04:00
2021-02-02 00:48:22 -05:00
if (spr.animation.curAnim.name == 'confirm' && !curStage.startsWith('school'))
2020-10-04 17:44:52 -04:00
{
spr.centerOffsets();
spr.offset.x -= 13;
spr.offset.y -= 13;
}
else
spr.centerOffsets();
});
2020-10-03 13:36:39 -04:00
}
2020-10-04 23:29:35 -04:00
function noteMiss(direction:Int = 1):Void
{
if (!boyfriend.stunned)
{
2021-01-31 21:43:09 -05:00
health -= 0.04;
if (combo > 5 && gf.animOffsets.exists('sad'))
2020-10-05 10:03:38 -04:00
{
gf.playAnim('sad');
}
combo = 0;
2020-11-01 14:16:22 -05:00
songScore -= 10;
2021-02-08 16:34:48 -05:00
FlxG.sound.play(Paths.soundRandom('missnote', 1, 3), FlxG.random.float(0.1, 0.2));
// FlxG.sound.play(Paths.sound('missnote1'), 1, false);
2020-10-30 19:47:19 -04:00
// FlxG.log.add('played imss note');
2020-10-05 03:49:53 -04:00
2020-10-04 23:29:35 -04:00
boyfriend.stunned = true;
// get stunned for 5 seconds
new FlxTimer().start(5 / 60, function(tmr:FlxTimer)
{
boyfriend.stunned = false;
});
switch (direction)
{
2021-02-13 17:39:31 -05:00
case 0:
boyfriend.playAnim('singLEFTmiss', true);
case 1:
boyfriend.playAnim('singDOWNmiss', true);
2020-10-04 23:29:35 -04:00
case 2:
2020-10-24 05:36:50 -04:00
boyfriend.playAnim('singUPmiss', true);
2020-10-04 23:29:35 -04:00
case 3:
2020-10-24 05:36:50 -04:00
boyfriend.playAnim('singRIGHTmiss', true);
2020-10-04 23:29:35 -04:00
}
}
}
function badNoteHit()
2020-10-04 23:29:35 -04:00
{
// just double pasting this shit cuz fuk u
2020-10-09 03:29:00 -04:00
// REDO THIS SYSTEM!
var leftP = controls.NOTE_LEFT_P;
var downP = controls.NOTE_DOWN_P;
2021-03-13 21:11:56 -05:00
var upP = controls.NOTE_UP_P;
var rightP = controls.NOTE_RIGHT_P;
2020-10-04 23:29:35 -04:00
if (leftP)
2020-10-13 22:12:31 -04:00
noteMiss(0);
2021-02-13 17:39:31 -05:00
if (downP)
noteMiss(1);
2020-10-04 23:29:35 -04:00
if (upP)
noteMiss(2);
2020-10-13 22:12:31 -04:00
if (rightP)
2020-10-04 23:29:35 -04:00
noteMiss(3);
}
2020-10-03 13:36:39 -04:00
function goodNoteHit(note:Note):Void
{
2020-10-03 15:32:15 -04:00
if (!note.wasGoodHit)
{
2020-10-30 19:47:19 -04:00
if (!note.isSustainNote)
{
2021-03-26 03:51:39 -04:00
popUpScore(note.strumTime, note);
2020-10-30 19:47:19 -04:00
combo += 1;
}
2020-10-05 03:49:53 -04:00
2020-10-13 22:12:31 -04:00
if (note.noteData >= 0)
2020-10-31 21:11:14 -04:00
health += 0.023;
2020-10-05 18:29:59 -04:00
else
2020-10-31 21:11:14 -04:00
health += 0.004;
2020-10-05 18:29:59 -04:00
2020-10-13 22:12:31 -04:00
switch (note.noteData)
2020-10-04 02:42:58 -04:00
{
2021-02-13 17:39:31 -05:00
case 0:
boyfriend.playAnim('singLEFT', true);
case 1:
boyfriend.playAnim('singDOWN', true);
2020-10-04 02:42:58 -04:00
case 2:
2021-01-20 01:38:39 -05:00
boyfriend.playAnim('singUP', true);
2020-10-04 02:42:58 -04:00
case 3:
2021-01-20 01:38:39 -05:00
boyfriend.playAnim('singRIGHT', true);
2020-10-04 02:42:58 -04:00
}
2020-10-04 14:50:12 -04:00
playerStrums.forEach(function(spr:FlxSprite)
{
if (Math.abs(note.noteData) == spr.ID)
{
spr.animation.play('confirm', true);
}
});
2020-10-03 15:32:15 -04:00
note.wasGoodHit = true;
2020-10-04 02:42:58 -04:00
vocals.volume = 1;
2020-10-05 18:29:59 -04:00
2021-02-13 17:39:31 -05:00
if (!note.isSustainNote)
{
note.kill();
notes.remove(note, true);
note.destroy();
}
2020-10-03 15:32:15 -04:00
}
2020-10-03 02:50:15 -04:00
}
2020-12-27 05:37:04 -05:00
var fastCarCanDrive:Bool = true;
function resetFastCar():Void
{
fastCar.x = -12600;
fastCar.y = FlxG.random.int(140, 250);
fastCar.velocity.x = 0;
fastCarCanDrive = true;
}
function fastCarDrive()
{
2021-02-08 16:34:48 -05:00
FlxG.sound.play(Paths.soundRandom('carPass', 0, 1), 0.7);
2020-12-27 05:37:04 -05:00
fastCar.velocity.x = (FlxG.random.int(170, 220) / FlxG.elapsed) * 3;
fastCarCanDrive = false;
new FlxTimer().start(2, function(tmr:FlxTimer)
{
resetFastCar();
});
}
2020-12-10 18:23:53 -05:00
var trainMoving:Bool = false;
var trainFrameTiming:Float = 0;
var trainCars:Int = 8;
var trainFinishing:Bool = false;
2020-12-11 08:08:41 -05:00
var trainCooldown:Int = 0;
2020-12-10 18:23:53 -05:00
function trainStart():Void
{
trainMoving = true;
trainSound.play(true);
2020-12-10 18:23:53 -05:00
}
var startedMoving:Bool = false;
function updateTrainPos():Void
{
if (trainSound.time >= 4700)
{
startedMoving = true;
2020-12-11 07:55:39 -05:00
gf.playAnim('hairBlow');
2020-12-10 18:23:53 -05:00
}
if (startedMoving)
{
phillyTrain.x -= 400;
if (phillyTrain.x < -2000 && !trainFinishing)
{
phillyTrain.x = -1150;
trainCars -= 1;
if (trainCars <= 0)
trainFinishing = true;
}
2020-12-11 04:15:24 -05:00
if (phillyTrain.x < -4000 && trainFinishing)
2020-12-10 18:23:53 -05:00
trainReset();
}
}
function trainReset():Void
{
2020-12-11 07:55:39 -05:00
gf.playAnim('hairFall');
2020-12-10 18:23:53 -05:00
phillyTrain.x = FlxG.width + 200;
trainMoving = false;
// trainSound.stop();
// trainSound.time = 0;
trainCars = 8;
2020-12-11 00:57:42 -05:00
trainFinishing = false;
2020-12-10 18:23:53 -05:00
startedMoving = false;
}
2020-11-02 01:46:37 -05:00
function lightningStrikeShit():Void
{
2021-02-08 16:34:48 -05:00
FlxG.sound.play(Paths.soundRandom('thunder_', 1, 2));
2020-11-02 01:46:37 -05:00
halloweenBG.animation.play('lightning');
lightningStrikeBeat = curBeat;
lightningOffset = FlxG.random.int(8, 24);
boyfriend.playAnim('scared', true);
gf.playAnim('scared', true);
}
2020-10-09 23:22:07 -04:00
override function stepHit()
{
super.stepHit();
2021-03-30 16:58:05 -04:00
if (Math.abs(FlxG.sound.music.time - Conductor.songPosition) > 20
|| (SONG.needsVoices && Math.abs(vocals.time - Conductor.songPosition) > 20))
2020-10-09 23:22:07 -04:00
{
2021-02-08 12:47:15 -05:00
resyncVocals();
2020-10-30 19:47:19 -04:00
}
if (dad.curCharacter == 'spooky' && curStep % 4 == 2)
2020-10-30 19:47:19 -04:00
{
// dad.dance();
2020-10-09 23:22:07 -04:00
}
}
2020-11-02 01:46:37 -05:00
var lightningStrikeBeat:Int = 0;
var lightningOffset:Int = 8;
override function beatHit()
2020-10-03 02:50:15 -04:00
{
super.beatHit();
2020-10-05 05:48:30 -04:00
2020-10-24 05:19:13 -04:00
if (generatedMusic)
{
2021-04-01 22:28:20 -04:00
notes.sort(sortNotes, FlxSort.DESCENDING);
2020-10-24 05:19:13 -04:00
}
2020-10-31 21:11:14 -04:00
if (SONG.notes[Math.floor(curStep / 16)] != null)
2020-10-30 19:47:19 -04:00
{
2020-10-31 21:11:14 -04:00
if (SONG.notes[Math.floor(curStep / 16)].changeBPM)
{
Conductor.changeBPM(SONG.notes[Math.floor(curStep / 16)].bpm);
FlxG.log.add('CHANGED BPM!');
}
2021-02-12 01:20:20 -05:00
// else
// Conductor.changeBPM(SONG.bpm);
2020-10-30 19:47:19 -04:00
}
2020-10-31 21:11:14 -04:00
// FlxG.log.add('change bpm' + SONG.notes[Std.int(curStep / 16)].changeBPM);
wiggleShit.update(Conductor.crochet);
2020-10-30 19:47:19 -04:00
2020-12-22 20:55:03 -05:00
// HARDCODING FOR MILF ZOOMS!
2021-03-26 21:28:04 -04:00
if (PreferencesMenu.getPref('camera-zoom'))
2020-11-02 01:46:37 -05:00
{
2021-03-26 21:28:04 -04:00
if (curSong.toLowerCase() == 'milf' && curBeat >= 168 && curBeat < 200 && camZooming && FlxG.camera.zoom < 1.35)
{
FlxG.camera.zoom += 0.015;
camHUD.zoom += 0.03;
}
if (camZooming && FlxG.camera.zoom < 1.35 && curBeat % 4 == 0)
{
FlxG.camera.zoom += 0.015;
camHUD.zoom += 0.03;
}
2020-11-02 01:46:37 -05:00
}
2020-10-03 13:36:39 -04:00
2020-12-24 18:24:11 -05:00
iconP1.setGraphicSize(Std.int(iconP1.width + 30));
iconP2.setGraphicSize(Std.int(iconP2.width + 30));
iconP1.updateHitbox();
iconP2.updateHitbox();
2020-10-05 08:55:39 -04:00
if (curBeat % gfSpeed == 0)
2020-10-30 19:47:19 -04:00
{
gf.dance();
2020-10-30 19:47:19 -04:00
}
2020-10-04 02:42:58 -04:00
if (curBeat % 2 == 0)
2021-01-20 01:38:39 -05:00
{
if (!boyfriend.animation.curAnim.name.startsWith("sing"))
boyfriend.playAnim('idle');
if (!dad.animation.curAnim.name.startsWith("sing"))
dad.dance();
}
else if (dad.curCharacter == 'spooky')
{
if (!dad.animation.curAnim.name.startsWith("sing"))
dad.dance();
2021-01-20 01:38:39 -05:00
}
2020-10-30 19:47:19 -04:00
if (curBeat % 8 == 7 && curSong == 'Bopeebo')
2020-10-30 19:47:19 -04:00
{
boyfriend.playAnim('hey', true);
2021-02-26 18:43:20 -05:00
}
2020-10-30 19:47:19 -04:00
2021-02-26 18:43:20 -05:00
if (curBeat % 16 == 15 && SONG.song == 'Tutorial' && dad.curCharacter == 'gf' && curBeat > 16 && curBeat < 48)
{
boyfriend.playAnim('hey', true);
dad.playAnim('cheer', true);
2020-10-30 19:47:19 -04:00
}
2020-11-02 01:46:37 -05:00
2021-03-08 18:38:58 -05:00
foregroundSprites.forEach(function(spr:BGSprite)
{
spr.dance();
});
2020-12-10 18:23:53 -05:00
switch (curStage)
{
2021-01-25 05:04:31 -05:00
case 'school':
bgGirls.dance();
2021-01-19 21:09:47 -05:00
case 'mall':
upperBoppers.animation.play('bop', true);
bottomBoppers.animation.play('bop', true);
2021-01-19 23:29:18 -05:00
santa.animation.play('idle', true);
2021-01-19 21:09:47 -05:00
2020-12-27 03:13:51 -05:00
case 'limo':
grpLimoDancers.forEach(function(dancer:BackgroundDancer)
{
dancer.dance();
});
2020-12-27 05:37:04 -05:00
if (FlxG.random.bool(10) && fastCarCanDrive)
fastCarDrive();
2020-12-10 18:23:53 -05:00
case "philly":
2020-12-11 08:08:41 -05:00
if (!trainMoving)
trainCooldown += 1;
if (curBeat % 4 == 0)
2020-12-10 18:23:53 -05:00
{
phillyCityLights.forEach(function(light:FlxSprite)
{
light.visible = false;
});
curLight = FlxG.random.int(0, phillyCityLights.length - 1);
phillyCityLights.members[curLight].visible = true;
2020-12-13 01:08:21 -05:00
// phillyCityLights.members[curLight].alpha = 1;
2020-12-10 18:23:53 -05:00
}
if (curBeat % 8 == 4 && FlxG.random.bool(30) && !trainMoving && trainCooldown > 8)
2020-12-10 18:23:53 -05:00
{
2020-12-11 08:08:41 -05:00
trainCooldown = FlxG.random.int(-4, 0);
2020-12-10 18:23:53 -05:00
trainStart();
}
}
2020-11-02 01:46:37 -05:00
if (isHalloween && FlxG.random.bool(10) && curBeat > lightningStrikeBeat + lightningOffset)
{
lightningStrikeShit();
}
2020-10-03 02:50:15 -04:00
}
2020-12-10 18:23:53 -05:00
var curLight:Int = 0;
2020-10-03 02:50:15 -04:00
}