2020-10-03 06:50:15 +00:00
|
|
|
package;
|
|
|
|
|
2020-10-24 09:19:13 +00:00
|
|
|
import Section.SwagSection;
|
|
|
|
import Song.SwagSong;
|
2020-10-25 20:51:06 +00:00
|
|
|
import flixel.FlxBasic;
|
|
|
|
import flixel.FlxCamera;
|
2020-10-03 06:50:15 +00:00
|
|
|
import flixel.FlxG;
|
2020-10-24 09:19:13 +00:00
|
|
|
import flixel.FlxGame;
|
2020-10-04 06:42:58 +00:00
|
|
|
import flixel.FlxObject;
|
2020-10-03 06:50:15 +00:00
|
|
|
import flixel.FlxSprite;
|
|
|
|
import flixel.FlxState;
|
2020-10-09 21:24:20 +00:00
|
|
|
import flixel.FlxSubState;
|
2020-10-04 21:44:52 +00:00
|
|
|
import flixel.addons.display.FlxGridOverlay;
|
2020-10-04 08:38:21 +00:00
|
|
|
import flixel.graphics.atlas.FlxAtlas;
|
2020-10-04 06:42:58 +00:00
|
|
|
import flixel.graphics.frames.FlxAtlasFrames;
|
2020-10-03 06:50:15 +00:00
|
|
|
import flixel.group.FlxGroup.FlxTypedGroup;
|
2020-10-05 09:48:30 +00:00
|
|
|
import flixel.math.FlxMath;
|
2020-11-01 01:11:14 +00:00
|
|
|
import flixel.math.FlxPoint;
|
2021-01-16 22:21:06 +00:00
|
|
|
import flixel.math.FlxRect;
|
2020-10-03 06:50:15 +00:00
|
|
|
import flixel.system.FlxSound;
|
|
|
|
import flixel.text.FlxText;
|
2020-10-05 18:24:51 +00:00
|
|
|
import flixel.tweens.FlxEase;
|
2020-10-03 19:32:15 +00:00
|
|
|
import flixel.tweens.FlxTween;
|
2020-10-05 20:32:41 +00:00
|
|
|
import flixel.ui.FlxBar;
|
2020-10-04 06:42:58 +00:00
|
|
|
import flixel.util.FlxCollision;
|
|
|
|
import flixel.util.FlxColor;
|
2020-10-05 05:13:12 +00:00
|
|
|
import flixel.util.FlxSort;
|
2020-10-04 06:42:58 +00:00
|
|
|
import flixel.util.FlxStringUtil;
|
2020-10-03 19:32:15 +00:00
|
|
|
import flixel.util.FlxTimer;
|
2020-10-03 06:50:15 +00:00
|
|
|
import haxe.Json;
|
|
|
|
import lime.utils.Assets;
|
2020-12-27 02:46:22 +00:00
|
|
|
import openfl.display.BlendMode;
|
|
|
|
import openfl.filters.ShaderFilter;
|
2020-10-03 06:50:15 +00:00
|
|
|
|
2020-10-04 06:42:58 +00:00
|
|
|
using StringTools;
|
|
|
|
|
2020-10-10 02:39:52 +00:00
|
|
|
class PlayState extends MusicBeatState
|
2020-10-03 06:50:15 +00:00
|
|
|
{
|
2020-11-01 01:11:14 +00:00
|
|
|
public static var curLevel:String = 'Tutorial';
|
2020-12-10 23:23:53 +00:00
|
|
|
public static var curStage:String = '';
|
2020-10-24 09:19:13 +00:00
|
|
|
public static var SONG:SwagSong;
|
2020-11-01 01:11:14 +00:00
|
|
|
public static var isStoryMode:Bool = false;
|
2020-11-07 02:17:27 +00:00
|
|
|
public static var storyWeek:Int = 0;
|
2020-11-01 01:11:14 +00:00
|
|
|
public static var storyPlaylist:Array<String> = [];
|
|
|
|
public static var storyDifficulty:Int = 1;
|
|
|
|
|
|
|
|
var halloweenLevel:Bool = false;
|
2020-10-05 22:29:59 +00:00
|
|
|
|
2020-10-04 06:42:58 +00:00
|
|
|
private var vocals:FlxSound;
|
2020-10-03 17:36:39 +00:00
|
|
|
|
2020-10-19 00:59:53 +00:00
|
|
|
private var dad:Character;
|
|
|
|
private var gf:Character;
|
2020-10-04 18:50:12 +00:00
|
|
|
private var boyfriend:Boyfriend;
|
2020-10-03 06:50:15 +00:00
|
|
|
|
|
|
|
private var notes:FlxTypedGroup<Note>;
|
2020-10-05 09:48:30 +00:00
|
|
|
private var unspawnNotes:Array<Note> = [];
|
2020-10-03 06:50:15 +00:00
|
|
|
|
|
|
|
private var strumLine:FlxSprite;
|
2020-10-03 19:32:15 +00:00
|
|
|
private var curSection:Int = 0;
|
|
|
|
|
2020-10-04 06:42:58 +00:00
|
|
|
private var camFollow:FlxObject;
|
2020-10-04 08:38:21 +00:00
|
|
|
private var strumLineNotes:FlxTypedGroup<FlxSprite>;
|
|
|
|
private var playerStrums:FlxTypedGroup<FlxSprite>;
|
2020-10-04 06:42:58 +00:00
|
|
|
|
2020-10-05 09:48:30 +00:00
|
|
|
private var camZooming:Bool = false;
|
|
|
|
private var curSong:String = "";
|
|
|
|
|
2020-10-05 12:55:39 +00:00
|
|
|
private var gfSpeed:Int = 1;
|
|
|
|
private var health:Float = 1;
|
2020-10-05 14:03:38 +00:00
|
|
|
private var combo:Int = 0;
|
2020-10-05 12:55:39 +00:00
|
|
|
|
2020-10-05 20:32:41 +00:00
|
|
|
private var healthBarBG:FlxSprite;
|
|
|
|
private var healthBar:FlxBar;
|
|
|
|
|
2020-10-05 18:24:51 +00:00
|
|
|
private var generatedMusic:Bool = false;
|
2020-10-23 23:12:38 +00:00
|
|
|
private var startingSong:Bool = false;
|
2020-10-05 18:24:51 +00:00
|
|
|
|
2020-12-24 23:24:11 +00:00
|
|
|
private var iconP1:HealthIcon;
|
|
|
|
private var iconP2:HealthIcon;
|
2020-10-26 09:16:05 +00:00
|
|
|
private var camHUD:FlxCamera;
|
|
|
|
private var camGame:FlxCamera;
|
2020-10-05 20:32:41 +00:00
|
|
|
|
2020-11-01 01:11:14 +00:00
|
|
|
var dialogue:Array<String> = ['blah blah blah', 'coolswag'];
|
|
|
|
|
|
|
|
var halloweenBG:FlxSprite;
|
2020-11-02 06:46:37 +00:00
|
|
|
var isHalloween:Bool = false;
|
2020-11-01 01:11:14 +00:00
|
|
|
|
2020-12-10 23:23:53 +00:00
|
|
|
var phillyCityLights:FlxTypedGroup<FlxSprite>;
|
|
|
|
var phillyTrain:FlxSprite;
|
|
|
|
var trainSound:FlxSound;
|
|
|
|
|
2020-12-27 02:46:22 +00:00
|
|
|
var limo:FlxSprite;
|
2020-12-27 08:13:51 +00:00
|
|
|
var grpLimoDancers:FlxTypedGroup<BackgroundDancer>;
|
2020-12-27 10:37:04 +00:00
|
|
|
var fastCar:FlxSprite;
|
2020-12-27 02:46:22 +00:00
|
|
|
|
2021-01-20 02:09:47 +00:00
|
|
|
var upperBoppers:FlxSprite;
|
|
|
|
var bottomBoppers:FlxSprite;
|
2021-01-20 04:29:18 +00:00
|
|
|
var santa:FlxSprite;
|
2021-01-20 02:09:47 +00:00
|
|
|
|
2020-11-01 01:11:14 +00:00
|
|
|
var talking:Bool = true;
|
2020-11-01 19:16:22 +00:00
|
|
|
var songScore:Int = 0;
|
2020-11-25 03:53:48 +00:00
|
|
|
var scoreTxt:FlxText;
|
2020-11-01 01:11:14 +00:00
|
|
|
|
2020-11-07 02:17:27 +00:00
|
|
|
public static var campaignScore:Int = 0;
|
|
|
|
|
2020-12-27 02:46:22 +00:00
|
|
|
var defaultCamZoom:Float = 1.05;
|
|
|
|
|
2020-10-03 06:50:15 +00:00
|
|
|
override public function create()
|
|
|
|
{
|
2020-10-26 09:16:05 +00:00
|
|
|
// var gameCam:FlxCamera = FlxG.camera;
|
|
|
|
camGame = new FlxCamera();
|
|
|
|
camHUD = new FlxCamera();
|
|
|
|
camHUD.bgColor.alpha = 0;
|
|
|
|
|
|
|
|
FlxG.cameras.reset(camGame);
|
|
|
|
FlxG.cameras.add(camHUD);
|
|
|
|
|
|
|
|
FlxCamera.defaultCameras = [camGame];
|
|
|
|
|
2020-10-05 18:24:51 +00:00
|
|
|
persistentUpdate = true;
|
|
|
|
persistentDraw = true;
|
|
|
|
|
2020-10-13 08:37:19 +00:00
|
|
|
if (SONG == null)
|
2020-10-21 23:33:43 +00:00
|
|
|
SONG = Song.loadFromJson(curLevel);
|
2020-10-13 08:37:19 +00:00
|
|
|
|
2020-10-30 23:47:19 +00:00
|
|
|
Conductor.changeBPM(SONG.bpm);
|
|
|
|
|
2020-11-01 01:11:14 +00: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!"
|
|
|
|
];
|
|
|
|
}
|
|
|
|
|
|
|
|
if (SONG.song.toLowerCase() == 'spookeez' || SONG.song.toLowerCase() == 'monster' || SONG.song.toLowerCase() == 'south')
|
|
|
|
{
|
2020-12-21 21:23:22 +00:00
|
|
|
curStage = "spooky";
|
2020-11-01 01:11:14 +00:00
|
|
|
halloweenLevel = true;
|
|
|
|
|
2021-01-05 12:53:42 +00:00
|
|
|
var hallowTex = FlxAtlasFrames.fromSparrow('assets/images/halloween_bg.png', 'assets/images/halloween_bg.xml');
|
2020-11-01 01:11:14 +00:00
|
|
|
|
|
|
|
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);
|
2020-11-02 06:46:37 +00:00
|
|
|
|
|
|
|
isHalloween = true;
|
2020-11-01 01:11:14 +00:00
|
|
|
}
|
2020-12-11 09:15:24 +00:00
|
|
|
else if (SONG.song.toLowerCase() == 'pico' || SONG.song.toLowerCase() == 'blammed' || SONG.song.toLowerCase() == 'philly')
|
2020-12-10 23:23:53 +00:00
|
|
|
{
|
|
|
|
curStage = 'philly';
|
|
|
|
|
2021-01-08 20:01:59 +00:00
|
|
|
var bg:FlxSprite = new FlxSprite(-100).loadGraphic('assets/images/philly/sky.png');
|
2020-12-10 23:23:53 +00:00
|
|
|
bg.scrollFactor.set(0.1, 0.1);
|
|
|
|
add(bg);
|
|
|
|
|
2021-01-08 20:01:59 +00:00
|
|
|
var city:FlxSprite = new FlxSprite(-10).loadGraphic('assets/images/philly/city.png');
|
2020-12-10 23:23:53 +00:00
|
|
|
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);
|
|
|
|
|
|
|
|
for (i in 0...5)
|
|
|
|
{
|
|
|
|
var light:FlxSprite = new FlxSprite(city.x).loadGraphic('assets/images/philly/win' + i + '.png');
|
|
|
|
light.scrollFactor.set(0.3, 0.3);
|
|
|
|
light.visible = false;
|
|
|
|
light.setGraphicSize(Std.int(light.width * 0.85));
|
|
|
|
light.updateHitbox();
|
|
|
|
phillyCityLights.add(light);
|
|
|
|
}
|
|
|
|
|
2021-01-08 20:01:59 +00:00
|
|
|
var streetBehind:FlxSprite = new FlxSprite(-40, 50).loadGraphic('assets/images/philly/behindTrain.png');
|
2020-12-10 23:23:53 +00:00
|
|
|
add(streetBehind);
|
|
|
|
|
2021-01-08 20:01:59 +00:00
|
|
|
phillyTrain = new FlxSprite(2000, 360).loadGraphic('assets/images/philly/train.png');
|
2020-12-10 23:23:53 +00:00
|
|
|
add(phillyTrain);
|
|
|
|
|
|
|
|
trainSound = new FlxSound().loadEmbedded('assets/sounds/train_passes' + TitleState.soundExt);
|
|
|
|
FlxG.sound.list.add(trainSound);
|
|
|
|
|
2021-01-05 12:53:42 +00:00
|
|
|
// var cityLights:FlxSprite = new FlxSprite().loadGraphic(AssetPaths.win0.png);
|
2020-12-10 23:23:53 +00:00
|
|
|
|
2021-01-08 20:01:59 +00:00
|
|
|
var street:FlxSprite = new FlxSprite(-40, streetBehind.y).loadGraphic('assets/images/philly/street.png');
|
2020-12-10 23:23:53 +00:00
|
|
|
add(street);
|
|
|
|
}
|
2020-12-27 02:46:22 +00:00
|
|
|
else if (SONG.song.toLowerCase() == 'milf' || SONG.song.toLowerCase() == 'satin-panties' || SONG.song.toLowerCase() == 'high')
|
|
|
|
{
|
|
|
|
curStage = 'limo';
|
|
|
|
defaultCamZoom = 0.90;
|
|
|
|
|
2021-01-05 12:53:42 +00:00
|
|
|
var skyBG:FlxSprite = new FlxSprite(-120, -50).loadGraphic('assets/images/limo/limoSunset.png');
|
2020-12-27 02:46:22 +00:00
|
|
|
skyBG.scrollFactor.set(0.1, 0.1);
|
|
|
|
add(skyBG);
|
|
|
|
|
2020-12-27 10:37:04 +00:00
|
|
|
var bgLimo:FlxSprite = new FlxSprite(-200, 480);
|
2021-01-05 12:53:42 +00:00
|
|
|
bgLimo.frames = FlxAtlasFrames.fromSparrow('assets/images/limo/bgLimo.png', 'assets/images/limo/bgLimo.xml');
|
2020-12-27 08:13:51 +00:00
|
|
|
bgLimo.animation.addByPrefix('drive', "background limo pink", 24);
|
2020-12-27 02:46:22 +00:00
|
|
|
bgLimo.animation.play('drive');
|
|
|
|
bgLimo.scrollFactor.set(0.4, 0.4);
|
|
|
|
add(bgLimo);
|
|
|
|
|
2020-12-27 08:13:51 +00:00
|
|
|
grpLimoDancers = new FlxTypedGroup<BackgroundDancer>();
|
|
|
|
add(grpLimoDancers);
|
|
|
|
|
|
|
|
for (i in 0...5)
|
|
|
|
{
|
2020-12-27 10:37:04 +00:00
|
|
|
var dancer:BackgroundDancer = new BackgroundDancer((370 * i) + 130, bgLimo.y - 400);
|
2020-12-27 08:13:51 +00:00
|
|
|
dancer.scrollFactor.set(0.4, 0.4);
|
|
|
|
grpLimoDancers.add(dancer);
|
|
|
|
}
|
|
|
|
|
2021-01-05 12:53:42 +00:00
|
|
|
var overlayShit:FlxSprite = new FlxSprite(-500, -600).loadGraphic('assets/images/limo/limoOverlay.png');
|
2020-12-27 02:46:22 +00:00
|
|
|
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;
|
|
|
|
|
2021-01-05 12:53:42 +00:00
|
|
|
var limoTex = FlxAtlasFrames.fromSparrow('assets/images/limo/limoDrive.png', 'assets/images/limo/limoDrive.xml');
|
2020-12-27 02:46:22 +00:00
|
|
|
|
|
|
|
limo = new FlxSprite(-120, 550);
|
|
|
|
limo.frames = limoTex;
|
|
|
|
limo.animation.addByPrefix('drive', "Limo stage", 24);
|
|
|
|
limo.animation.play('drive');
|
|
|
|
limo.antialiasing = true;
|
2020-12-27 10:37:04 +00:00
|
|
|
|
2021-01-05 12:53:42 +00:00
|
|
|
fastCar = new FlxSprite(-300, 160).loadGraphic('assets/images/limo/fastCarLol.png');
|
2020-12-27 02:46:22 +00:00
|
|
|
// add(limo);
|
|
|
|
}
|
2021-01-20 02:09:47 +00:00
|
|
|
else if (SONG.song.toLowerCase() == 'cocoa' || SONG.song.toLowerCase() == 'eggnog')
|
|
|
|
{
|
|
|
|
curStage = 'mall';
|
|
|
|
|
2021-01-20 03:58:07 +00:00
|
|
|
defaultCamZoom = 0.80;
|
|
|
|
|
|
|
|
var bg:FlxSprite = new FlxSprite(-1000, -500).loadGraphic('assets/images/christmas/bgWalls.png');
|
2021-01-20 02:09:47 +00:00
|
|
|
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);
|
|
|
|
|
2021-01-20 03:58:07 +00:00
|
|
|
upperBoppers = new FlxSprite(-240, -90);
|
2021-01-20 02:09:47 +00:00
|
|
|
upperBoppers.frames = FlxAtlasFrames.fromSparrow('assets/images/christmas/upperBop.png', 'assets/images/christmas/upperBop.xml');
|
|
|
|
upperBoppers.animation.addByPrefix('bop', "Upper Crowd Bob", 24, false);
|
|
|
|
upperBoppers.antialiasing = true;
|
|
|
|
upperBoppers.scrollFactor.set(0.33, 0.33);
|
2021-01-20 03:58:07 +00:00
|
|
|
upperBoppers.setGraphicSize(Std.int(upperBoppers.width * 0.85));
|
2021-01-20 02:09:47 +00:00
|
|
|
upperBoppers.updateHitbox();
|
|
|
|
add(upperBoppers);
|
|
|
|
|
2021-01-20 03:58:07 +00:00
|
|
|
var bgEscalator:FlxSprite = new FlxSprite(-1100, -600).loadGraphic('assets/images/christmas/bgEscalator.png');
|
2021-01-20 02:09:47 +00:00
|
|
|
bgEscalator.antialiasing = true;
|
|
|
|
bgEscalator.scrollFactor.set(0.3, 0.3);
|
|
|
|
bgEscalator.active = false;
|
2021-01-20 03:58:07 +00:00
|
|
|
bgEscalator.setGraphicSize(Std.int(bgEscalator.width * 0.9));
|
2021-01-20 02:09:47 +00:00
|
|
|
bgEscalator.updateHitbox();
|
|
|
|
add(bgEscalator);
|
|
|
|
|
2021-01-20 03:58:07 +00:00
|
|
|
var tree:FlxSprite = new FlxSprite(370, -250).loadGraphic('assets/images/christmas/christmasTree.png');
|
2021-01-20 02:09:47 +00:00
|
|
|
tree.antialiasing = true;
|
2021-01-20 03:58:07 +00:00
|
|
|
tree.scrollFactor.set(0.40, 0.40);
|
2021-01-20 02:09:47 +00:00
|
|
|
add(tree);
|
|
|
|
|
2021-01-20 03:58:07 +00:00
|
|
|
bottomBoppers = new FlxSprite(-300, 140);
|
2021-01-20 02:09:47 +00:00
|
|
|
bottomBoppers.frames = FlxAtlasFrames.fromSparrow('assets/images/christmas/bottomBop.png', 'assets/images/christmas/bottomBop.xml');
|
|
|
|
bottomBoppers.animation.addByPrefix('bop', 'Bottom Level Boppers', 24, false);
|
|
|
|
bottomBoppers.antialiasing = true;
|
|
|
|
bottomBoppers.scrollFactor.set(0.9, 0.9);
|
2021-01-20 03:58:07 +00:00
|
|
|
bottomBoppers.setGraphicSize(Std.int(bottomBoppers.width * 1));
|
2021-01-20 02:09:47 +00:00
|
|
|
bottomBoppers.updateHitbox();
|
|
|
|
add(bottomBoppers);
|
2021-01-20 03:58:07 +00:00
|
|
|
|
|
|
|
var fgSnow:FlxSprite = new FlxSprite(-600, 700).loadGraphic('assets/images/christmas/fgSnow.png');
|
|
|
|
fgSnow.active = false;
|
|
|
|
fgSnow.antialiasing = true;
|
|
|
|
add(fgSnow);
|
2021-01-20 04:29:18 +00:00
|
|
|
|
|
|
|
santa = new FlxSprite(-840, 150);
|
|
|
|
santa.frames = FlxAtlasFrames.fromSparrow('assets/images/christmas/santa.png', 'assets/images/christmas/santa.xml');
|
|
|
|
santa.animation.addByPrefix('idle', 'santa idle in fear', 24, false);
|
|
|
|
santa.antialiasing = true;
|
|
|
|
add(santa);
|
2021-01-20 02:09:47 +00:00
|
|
|
}
|
2021-01-20 06:38:39 +00:00
|
|
|
else if (SONG.song.toLowerCase() == 'winter-horrorland')
|
|
|
|
{
|
|
|
|
var bg:FlxSprite = new FlxSprite(-600, -400).loadGraphic('assets/images/christmas/evilBG.png');
|
|
|
|
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);
|
|
|
|
|
|
|
|
var evilTree:FlxSprite = new FlxSprite(300, -500).loadGraphic('assets/images/christmas/evilTree.png');
|
|
|
|
evilTree.antialiasing = true;
|
|
|
|
evilTree.scrollFactor.set(0.4, 0.4);
|
|
|
|
add(evilTree);
|
|
|
|
|
|
|
|
var evilSnow:FlxSprite = new FlxSprite(-200, 700).loadGraphic("assets/images/christmas/evilSnow.png");
|
|
|
|
evilSnow.antialiasing = true;
|
|
|
|
add(evilSnow);
|
|
|
|
}
|
2020-11-01 01:11:14 +00:00
|
|
|
else
|
|
|
|
{
|
2020-12-17 20:03:33 +00:00
|
|
|
curStage = 'stage';
|
2021-01-05 12:53:42 +00:00
|
|
|
var bg:FlxSprite = new FlxSprite(-600, -200).loadGraphic('assets/images/stageback.png');
|
2020-11-01 01:11:14 +00:00
|
|
|
// bg.setGraphicSize(Std.int(bg.width * 2.5));
|
|
|
|
// bg.updateHitbox();
|
|
|
|
bg.antialiasing = true;
|
|
|
|
bg.scrollFactor.set(0.9, 0.9);
|
|
|
|
bg.active = false;
|
|
|
|
add(bg);
|
|
|
|
|
2021-01-05 12:53:42 +00:00
|
|
|
var stageFront:FlxSprite = new FlxSprite(-650, 600).loadGraphic('assets/images/stagefront.png');
|
2020-11-01 01:11:14 +00:00
|
|
|
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);
|
|
|
|
|
2021-01-05 12:53:42 +00:00
|
|
|
var stageCurtains:FlxSprite = new FlxSprite(-500, -300).loadGraphic('assets/images/stagecurtains.png');
|
2020-11-01 01:11:14 +00:00
|
|
|
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-05 20:55:48 +00:00
|
|
|
|
2021-01-15 04:33:12 +00:00
|
|
|
var gfVersion:String = 'gf';
|
|
|
|
|
2021-01-20 02:09:47 +00:00
|
|
|
switch (curStage)
|
|
|
|
{
|
|
|
|
case 'limo':
|
|
|
|
gfVersion = 'gf-car';
|
|
|
|
case 'mall':
|
|
|
|
gfVersion = 'gf-christmas';
|
|
|
|
}
|
|
|
|
|
2021-01-15 04:33:12 +00:00
|
|
|
if (curStage == 'limo')
|
|
|
|
gfVersion = 'gf-car';
|
|
|
|
|
|
|
|
gf = new Character(400, 130, gfVersion);
|
2020-10-05 11:46:57 +00:00
|
|
|
gf.scrollFactor.set(0.95, 0.95);
|
2020-10-05 12:55:39 +00:00
|
|
|
gf.antialiasing = true;
|
2020-10-05 11:46:57 +00:00
|
|
|
add(gf);
|
|
|
|
|
2020-12-27 02:46:22 +00:00
|
|
|
// Shitty layering but whatev it works LOL
|
|
|
|
if (curStage == 'limo')
|
|
|
|
add(limo);
|
|
|
|
|
2020-10-19 00:59:53 +00:00
|
|
|
dad = new Character(100, 100, SONG.player2);
|
2020-10-03 06:50:15 +00:00
|
|
|
add(dad);
|
|
|
|
|
2020-11-01 01:11:14 +00:00
|
|
|
var camPos:FlxPoint = new FlxPoint(dad.getGraphicMidpoint().x, dad.getGraphicMidpoint().y);
|
|
|
|
|
2020-10-23 23:12:38 +00:00
|
|
|
switch (SONG.player2)
|
2020-10-19 00:59:53 +00:00
|
|
|
{
|
2020-10-23 23:12:38 +00:00
|
|
|
case 'gf':
|
|
|
|
dad.setPosition(gf.x, gf.y);
|
|
|
|
gf.visible = false;
|
2020-11-01 01:11:14 +00:00
|
|
|
if (isStoryMode)
|
|
|
|
{
|
|
|
|
camPos.x += 600;
|
|
|
|
tweenCamIn();
|
|
|
|
}
|
|
|
|
|
2020-10-23 23:12:38 +00:00
|
|
|
case "spooky":
|
|
|
|
dad.y += 200;
|
2020-10-30 23:47:19 +00:00
|
|
|
case "monster":
|
|
|
|
dad.y += 100;
|
2021-01-20 06:38:39 +00:00
|
|
|
case 'monster-christmas':
|
|
|
|
dad.y += 130;
|
2020-11-01 01:11:14 +00:00
|
|
|
case 'dad':
|
|
|
|
camPos.x += 400;
|
2020-12-09 22:46:47 +00:00
|
|
|
case 'pico':
|
2020-12-10 23:23:53 +00:00
|
|
|
camPos.x += 600;
|
2020-12-09 22:46:47 +00:00
|
|
|
dad.y += 300;
|
2021-01-20 02:09:47 +00:00
|
|
|
case 'parents-christmas':
|
|
|
|
dad.x -= 500;
|
2020-10-19 00:59:53 +00:00
|
|
|
}
|
|
|
|
|
2021-01-14 03:38:31 +00:00
|
|
|
boyfriend = new Boyfriend(770, 450, SONG.player1);
|
2020-10-03 06:50:15 +00:00
|
|
|
add(boyfriend);
|
|
|
|
|
2020-12-27 02:46:22 +00:00
|
|
|
// REPOSITIONING PER STAGE
|
|
|
|
switch (curStage)
|
|
|
|
{
|
|
|
|
case 'limo':
|
|
|
|
{
|
|
|
|
boyfriend.y -= 220;
|
|
|
|
boyfriend.x += 260;
|
2020-12-27 10:37:04 +00:00
|
|
|
|
|
|
|
resetFastCar();
|
|
|
|
add(fastCar);
|
2020-12-27 02:46:22 +00:00
|
|
|
}
|
2021-01-20 03:58:07 +00:00
|
|
|
case 'mall':
|
|
|
|
{
|
|
|
|
boyfriend.x += 200;
|
|
|
|
}
|
2020-12-27 02:46:22 +00:00
|
|
|
}
|
|
|
|
|
2020-11-01 01:11:14 +00:00
|
|
|
var doof:DialogueBox = new DialogueBox(false, dialogue);
|
|
|
|
// doof.x += 70;
|
|
|
|
doof.y = FlxG.height * 0.5;
|
|
|
|
doof.scrollFactor.set();
|
|
|
|
doof.finishThing = startCountdown;
|
|
|
|
|
|
|
|
Conductor.songPosition = -5000;
|
2020-10-05 20:55:48 +00:00
|
|
|
|
2020-10-04 08:38:21 +00:00
|
|
|
strumLine = new FlxSprite(0, 50).makeGraphic(FlxG.width, 10);
|
|
|
|
strumLine.scrollFactor.set();
|
|
|
|
|
|
|
|
strumLineNotes = new FlxTypedGroup<FlxSprite>();
|
|
|
|
add(strumLineNotes);
|
|
|
|
|
|
|
|
playerStrums = new FlxTypedGroup<FlxSprite>();
|
|
|
|
|
2020-10-23 23:12:38 +00:00
|
|
|
startingSong = true;
|
|
|
|
|
2020-11-01 01:11:14 +00:00
|
|
|
// startCountdown();
|
2020-10-05 18:24:51 +00:00
|
|
|
|
2020-10-13 08:37:19 +00:00
|
|
|
generateSong(SONG.song);
|
2020-10-23 23:12:38 +00:00
|
|
|
|
|
|
|
// add(strumLine);
|
|
|
|
|
|
|
|
camFollow = new FlxObject(0, 0, 1, 1);
|
2020-11-01 01:11:14 +00:00
|
|
|
|
|
|
|
camFollow.setPosition(camPos.x, camPos.y);
|
2020-10-23 23:12:38 +00:00
|
|
|
add(camFollow);
|
|
|
|
|
|
|
|
FlxG.camera.follow(camFollow, LOCKON, 0.04);
|
|
|
|
// FlxG.camera.setScrollBounds(0, FlxG.width, 0, FlxG.height);
|
2020-12-27 02:46:22 +00:00
|
|
|
FlxG.camera.zoom = defaultCamZoom;
|
2020-10-23 23:12:38 +00:00
|
|
|
|
|
|
|
FlxG.worldBounds.set(0, 0, FlxG.width, FlxG.height);
|
|
|
|
|
|
|
|
FlxG.fixedTimestep = false;
|
|
|
|
|
2021-01-05 12:53:42 +00:00
|
|
|
healthBarBG = new FlxSprite(0, FlxG.height * 0.9).loadGraphic('assets/images/healthBar.png');
|
2020-10-23 23:12:38 +00:00
|
|
|
healthBarBG.screenCenter(X);
|
|
|
|
healthBarBG.scrollFactor.set();
|
|
|
|
add(healthBarBG);
|
|
|
|
|
|
|
|
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-25 03:53:48 +00:00
|
|
|
scoreTxt = new FlxText(healthBarBG.x + healthBarBG.width - 190, healthBarBG.y + 30, 0, "", 20);
|
|
|
|
scoreTxt.setFormat("assets/fonts/vcr.ttf", 16, FlxColor.WHITE, RIGHT);
|
|
|
|
scoreTxt.scrollFactor.set();
|
|
|
|
add(scoreTxt);
|
|
|
|
|
2020-12-24 23:24:11 +00: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);
|
|
|
|
|
2020-11-01 01:11:14 +00:00
|
|
|
if (isStoryMode)
|
|
|
|
{
|
|
|
|
// TEMP for now, later get rid of startCountdown()
|
|
|
|
// add(doof);
|
|
|
|
startCountdown();
|
|
|
|
}
|
|
|
|
else
|
|
|
|
startCountdown();
|
|
|
|
|
2020-10-26 09:16:05 +00:00
|
|
|
strumLineNotes.cameras = [camHUD];
|
|
|
|
notes.cameras = [camHUD];
|
2020-10-30 23:47:19 +00:00
|
|
|
healthBar.cameras = [camHUD];
|
|
|
|
healthBarBG.cameras = [camHUD];
|
2020-12-24 23:24:11 +00:00
|
|
|
iconP1.cameras = [camHUD];
|
|
|
|
iconP2.cameras = [camHUD];
|
2020-11-25 03:53:48 +00:00
|
|
|
scoreTxt.cameras = [camHUD];
|
2020-11-01 01:11:14 +00:00
|
|
|
doof.cameras = [camHUD];
|
2020-10-30 23:47:19 +00:00
|
|
|
|
|
|
|
// if (SONG.song == 'South')
|
|
|
|
// FlxG.camera.alpha = 0.7;
|
2020-10-26 09:16:05 +00:00
|
|
|
// UI_camera.zoom = 1;
|
|
|
|
|
|
|
|
// cameras = [FlxG.cameras.list[1]];
|
2020-10-25 20:51:06 +00:00
|
|
|
|
2020-11-07 21:13:41 +00:00
|
|
|
#if lime
|
|
|
|
trace("IT'S LIME");
|
|
|
|
#end
|
|
|
|
|
2020-10-23 23:12:38 +00:00
|
|
|
super.create();
|
|
|
|
}
|
|
|
|
|
2020-10-26 09:16:05 +00:00
|
|
|
var startTimer:FlxTimer;
|
2020-12-23 01:55:03 +00:00
|
|
|
var perfectMode:Bool = false;
|
2020-10-26 09:16:05 +00:00
|
|
|
|
2020-10-23 23:12:38 +00:00
|
|
|
function startCountdown():Void
|
|
|
|
{
|
2020-11-01 01:11:14 +00:00
|
|
|
generateStaticArrows(0);
|
|
|
|
generateStaticArrows(1);
|
|
|
|
|
|
|
|
talking = false;
|
2020-10-23 23:12:38 +00:00
|
|
|
startedCountdown = true;
|
2020-10-05 22:29:59 +00:00
|
|
|
Conductor.songPosition = 0;
|
2020-10-05 20:32:41 +00:00
|
|
|
Conductor.songPosition -= Conductor.crochet * 5;
|
2020-10-05 18:24:51 +00:00
|
|
|
|
2020-10-23 23:12:38 +00:00
|
|
|
var swagCounter:Int = 0;
|
|
|
|
|
2020-10-26 09:16:05 +00:00
|
|
|
startTimer = new FlxTimer().start(Conductor.crochet / 1000, function(tmr:FlxTimer)
|
2020-10-05 18:24:51 +00:00
|
|
|
{
|
2020-10-30 23:47:19 +00:00
|
|
|
dad.dance();
|
|
|
|
gf.dance();
|
|
|
|
boyfriend.playAnim('idle');
|
|
|
|
|
2020-10-05 18:24:51 +00:00
|
|
|
switch (swagCounter)
|
|
|
|
{
|
|
|
|
case 0:
|
2020-10-07 01:56:33 +00:00
|
|
|
FlxG.sound.play('assets/sounds/intro3' + TitleState.soundExt, 0.6);
|
2020-10-05 18:24:51 +00:00
|
|
|
case 1:
|
2020-10-05 18:33:56 +00:00
|
|
|
var ready:FlxSprite = new FlxSprite().loadGraphic('assets/images/ready.png');
|
|
|
|
ready.scrollFactor.set();
|
|
|
|
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();
|
|
|
|
}
|
|
|
|
});
|
2020-10-07 01:56:33 +00:00
|
|
|
FlxG.sound.play('assets/sounds/intro2' + TitleState.soundExt, 0.6);
|
2020-10-05 18:24:51 +00:00
|
|
|
case 2:
|
2020-10-05 18:33:56 +00:00
|
|
|
var set:FlxSprite = new FlxSprite().loadGraphic('assets/images/set.png');
|
|
|
|
set.scrollFactor.set();
|
|
|
|
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();
|
|
|
|
}
|
|
|
|
});
|
2020-10-07 01:56:33 +00:00
|
|
|
FlxG.sound.play('assets/sounds/intro1' + TitleState.soundExt, 0.6);
|
2020-10-05 18:24:51 +00:00
|
|
|
case 3:
|
2020-10-05 18:33:56 +00:00
|
|
|
var go:FlxSprite = new FlxSprite().loadGraphic('assets/images/go.png');
|
|
|
|
go.scrollFactor.set();
|
|
|
|
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();
|
|
|
|
}
|
|
|
|
});
|
2020-10-07 01:56:33 +00:00
|
|
|
FlxG.sound.play('assets/sounds/introGo' + TitleState.soundExt, 0.6);
|
2020-10-05 18:24:51 +00:00
|
|
|
case 4:
|
|
|
|
}
|
|
|
|
|
|
|
|
swagCounter += 1;
|
|
|
|
// generateSong('fresh');
|
|
|
|
}, 5);
|
2020-10-03 06:50:15 +00:00
|
|
|
}
|
|
|
|
|
2020-10-24 09:19:13 +00:00
|
|
|
var previousFrameTime:Int = 0;
|
|
|
|
var lastReportedPlayheadPosition:Int = 0;
|
|
|
|
var songTime:Float = 0;
|
|
|
|
|
2020-10-05 18:24:51 +00:00
|
|
|
function startSong():Void
|
|
|
|
{
|
2020-12-10 05:41:31 +00:00
|
|
|
startingSong = false;
|
|
|
|
|
2020-10-24 09:19:13 +00:00
|
|
|
previousFrameTime = FlxG.game.ticks;
|
|
|
|
lastReportedPlayheadPosition = 0;
|
|
|
|
|
2020-12-10 05:41:31 +00:00
|
|
|
if (!paused)
|
|
|
|
FlxG.sound.playMusic("assets/music/" + SONG.song + "_Inst" + TitleState.soundExt, 1, false);
|
2020-11-01 01:11:14 +00:00
|
|
|
FlxG.sound.music.onComplete = endSong;
|
2020-10-05 18:24:51 +00:00
|
|
|
vocals.play();
|
|
|
|
}
|
|
|
|
|
2020-10-03 06:50:15 +00:00
|
|
|
var debugNum:Int = 0;
|
|
|
|
|
|
|
|
private function generateSong(dataPath:String):Void
|
|
|
|
{
|
2020-10-04 06:42:58 +00:00
|
|
|
// FlxG.log.add(ChartParser.parse());
|
|
|
|
|
2020-10-13 08:37:19 +00:00
|
|
|
var songData = SONG;
|
2020-10-05 00:53:49 +00:00
|
|
|
Conductor.changeBPM(songData.bpm);
|
2020-10-04 06:42:58 +00:00
|
|
|
|
2020-10-05 09:48:30 +00:00
|
|
|
curSong = songData.song;
|
|
|
|
|
2020-10-14 08:30:54 +00:00
|
|
|
if (SONG.needsVoices)
|
|
|
|
vocals = new FlxSound().loadEmbedded("assets/music/" + curSong + "_Voices" + TitleState.soundExt);
|
|
|
|
else
|
|
|
|
vocals = new FlxSound();
|
|
|
|
|
2020-10-04 06:42:58 +00:00
|
|
|
FlxG.sound.list.add(vocals);
|
2020-10-03 06:50:15 +00:00
|
|
|
|
|
|
|
notes = new FlxTypedGroup<Note>();
|
|
|
|
add(notes);
|
|
|
|
|
2020-10-24 09:19:13 +00:00
|
|
|
var noteData:Array<SwagSection>;
|
2020-10-04 06:42:58 +00:00
|
|
|
|
2020-10-13 08:37:19 +00:00
|
|
|
// NEW SHIT
|
|
|
|
noteData = songData.notes;
|
|
|
|
|
2020-10-03 06:50:15 +00:00
|
|
|
var playerCounter:Int = 0;
|
|
|
|
|
2020-10-16 11:03:10 +00:00
|
|
|
var daBeats:Int = 0; // Not exactly representative of 'daBeats' lol, just how much it has looped
|
|
|
|
for (section in noteData)
|
2020-10-03 06:50:15 +00:00
|
|
|
{
|
2020-10-16 11:03:10 +00:00
|
|
|
var coolSection:Int = Std.int(section.lengthInSteps / 4);
|
2020-10-05 00:53:49 +00:00
|
|
|
|
2020-10-19 00:59:53 +00:00
|
|
|
for (songNotes in section.sectionNotes)
|
2020-10-16 11:03:10 +00:00
|
|
|
{
|
2020-10-20 01:59:00 +00:00
|
|
|
var daStrumTime:Float = songNotes[0];
|
|
|
|
var daNoteData:Int = Std.int(songNotes[1] % 4);
|
2020-10-18 01:47:59 +00:00
|
|
|
|
|
|
|
var gottaHitNote:Bool = section.mustHitSection;
|
|
|
|
|
2020-10-30 23:47:19 +00:00
|
|
|
if (songNotes[1] > 3)
|
2020-10-18 01:47:59 +00:00
|
|
|
{
|
|
|
|
gottaHitNote = !section.mustHitSection;
|
|
|
|
}
|
2020-10-13 08:37:19 +00:00
|
|
|
|
2020-10-16 11:03:10 +00:00
|
|
|
var oldNote:Note;
|
|
|
|
if (unspawnNotes.length > 0)
|
|
|
|
oldNote = unspawnNotes[Std.int(unspawnNotes.length - 1)];
|
|
|
|
else
|
|
|
|
oldNote = null;
|
2020-10-05 05:13:12 +00:00
|
|
|
|
2020-10-16 11:03:10 +00:00
|
|
|
var swagNote:Note = new Note(daStrumTime, daNoteData, oldNote);
|
2020-10-20 01:59:00 +00:00
|
|
|
swagNote.sustainLength = songNotes[2];
|
2020-10-16 11:03:10 +00:00
|
|
|
swagNote.scrollFactor.set(0, 0);
|
2020-10-03 06:50:15 +00:00
|
|
|
|
2020-10-20 01:59:00 +00:00
|
|
|
var susLength:Float = swagNote.sustainLength;
|
|
|
|
|
|
|
|
susLength = susLength / Conductor.stepCrochet;
|
2020-10-16 11:03:10 +00:00
|
|
|
unspawnNotes.push(swagNote);
|
2020-10-05 09:48:30 +00:00
|
|
|
|
2020-10-20 01:59:00 +00:00
|
|
|
for (susNote in 0...Math.floor(susLength))
|
|
|
|
{
|
|
|
|
oldNote = unspawnNotes[Std.int(unspawnNotes.length - 1)];
|
|
|
|
|
2020-10-21 20:12:32 +00:00
|
|
|
var sustainNote:Note = new Note(daStrumTime + (Conductor.stepCrochet * susNote) + Conductor.stepCrochet, daNoteData, oldNote, true);
|
2020-10-20 01:59:00 +00:00
|
|
|
sustainNote.scrollFactor.set();
|
|
|
|
unspawnNotes.push(sustainNote);
|
|
|
|
|
|
|
|
sustainNote.mustPress = gottaHitNote;
|
|
|
|
|
|
|
|
if (sustainNote.mustPress)
|
|
|
|
{
|
|
|
|
sustainNote.x += FlxG.width / 2; // general offset
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-10-18 01:47:59 +00:00
|
|
|
swagNote.mustPress = gottaHitNote;
|
2020-10-03 06:50:15 +00:00
|
|
|
|
2020-10-16 11:03:10 +00:00
|
|
|
if (swagNote.mustPress)
|
|
|
|
{
|
2020-10-16 11:15:17 +00:00
|
|
|
swagNote.x += FlxG.width / 2; // general offset
|
2020-10-16 11:03:10 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2020-10-03 06:50:15 +00:00
|
|
|
}
|
|
|
|
}
|
2020-10-16 11:03:10 +00:00
|
|
|
daBeats += 1;
|
2020-10-03 06:50:15 +00:00
|
|
|
}
|
2020-10-05 09:48:30 +00:00
|
|
|
|
2020-11-07 02:17:27 +00:00
|
|
|
// trace(unspawnNotes.length);
|
2020-10-16 11:03:10 +00:00
|
|
|
// playerCounter += 1;
|
|
|
|
|
2020-10-05 09:48:30 +00:00
|
|
|
unspawnNotes.sort(sortByShit);
|
2020-10-18 07:27:39 +00:00
|
|
|
|
|
|
|
generatedMusic = true;
|
2020-10-05 09:48:30 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
function sortByShit(Obj1:Note, Obj2:Note):Int
|
|
|
|
{
|
|
|
|
return FlxSort.byValues(FlxSort.ASCENDING, Obj1.strumTime, Obj2.strumTime);
|
2020-10-03 06:50:15 +00:00
|
|
|
}
|
|
|
|
|
2020-10-04 08:38:21 +00:00
|
|
|
private function generateStaticArrows(player:Int):Void
|
|
|
|
{
|
|
|
|
for (i in 0...4)
|
|
|
|
{
|
|
|
|
FlxG.log.add(i);
|
|
|
|
var babyArrow:FlxSprite = new FlxSprite(0, strumLine.y);
|
2021-01-05 12:53:42 +00:00
|
|
|
var arrTex = FlxAtlasFrames.fromSparrow('assets/images/NOTE_assets.png', 'assets/images/NOTE_assets.xml');
|
2020-10-04 08:38:21 +00:00
|
|
|
babyArrow.frames = arrTex;
|
|
|
|
babyArrow.animation.addByPrefix('green', 'arrowUP');
|
|
|
|
babyArrow.animation.addByPrefix('blue', 'arrowDOWN');
|
|
|
|
babyArrow.animation.addByPrefix('purple', 'arrowLEFT');
|
|
|
|
babyArrow.animation.addByPrefix('red', 'arrowRIGHT');
|
|
|
|
|
|
|
|
babyArrow.scrollFactor.set();
|
|
|
|
babyArrow.setGraphicSize(Std.int(babyArrow.width * 0.7));
|
|
|
|
babyArrow.updateHitbox();
|
2020-10-05 02:31:38 +00:00
|
|
|
babyArrow.antialiasing = true;
|
2020-10-04 08:38:21 +00:00
|
|
|
|
2020-10-05 18:24:51 +00:00
|
|
|
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-14 02:12:31 +00:00
|
|
|
babyArrow.ID = i;
|
2020-10-04 08:38:21 +00:00
|
|
|
|
|
|
|
if (player == 1)
|
|
|
|
{
|
|
|
|
playerStrums.add(babyArrow);
|
|
|
|
}
|
|
|
|
|
2020-10-14 02:12:31 +00:00
|
|
|
switch (Math.abs(i))
|
2020-10-04 08:38:21 +00:00
|
|
|
{
|
2020-10-14 02:12:31 +00:00
|
|
|
case 2:
|
2020-10-04 08:38:21 +00:00
|
|
|
babyArrow.x += Note.swagWidth * 2;
|
|
|
|
babyArrow.animation.addByPrefix('static', 'arrowUP');
|
|
|
|
babyArrow.animation.addByPrefix('pressed', 'up press', 24, false);
|
2020-10-04 18:50:12 +00:00
|
|
|
babyArrow.animation.addByPrefix('confirm', 'up confirm', 24, false);
|
2020-10-14 02:12:31 +00:00
|
|
|
case 3:
|
2020-10-04 08:38:21 +00:00
|
|
|
babyArrow.x += Note.swagWidth * 3;
|
|
|
|
babyArrow.animation.addByPrefix('static', 'arrowRIGHT');
|
|
|
|
babyArrow.animation.addByPrefix('pressed', 'right press', 24, false);
|
2020-10-04 18:50:12 +00:00
|
|
|
babyArrow.animation.addByPrefix('confirm', 'right confirm', 24, false);
|
2020-10-14 02:12:31 +00:00
|
|
|
case 1:
|
2020-10-04 08:38:21 +00:00
|
|
|
babyArrow.x += Note.swagWidth * 1;
|
|
|
|
babyArrow.animation.addByPrefix('static', 'arrowDOWN');
|
|
|
|
babyArrow.animation.addByPrefix('pressed', 'down press', 24, false);
|
2020-10-04 18:50:12 +00:00
|
|
|
babyArrow.animation.addByPrefix('confirm', 'down confirm', 24, false);
|
2020-10-14 02:12:31 +00:00
|
|
|
case 0:
|
2020-10-04 08:38:21 +00:00
|
|
|
babyArrow.x += Note.swagWidth * 0;
|
|
|
|
babyArrow.animation.addByPrefix('static', 'arrowLEFT');
|
|
|
|
babyArrow.animation.addByPrefix('pressed', 'left press', 24, false);
|
2020-10-04 18:50:12 +00:00
|
|
|
babyArrow.animation.addByPrefix('confirm', 'left confirm', 24, false);
|
2020-10-04 08:38:21 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
babyArrow.animation.play('static');
|
|
|
|
babyArrow.x += 50;
|
|
|
|
babyArrow.x += ((FlxG.width / 2) * player);
|
|
|
|
|
|
|
|
strumLineNotes.add(babyArrow);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-11-01 01:11:14 +00:00
|
|
|
function tweenCamIn():Void
|
|
|
|
{
|
|
|
|
FlxTween.tween(FlxG.camera, {zoom: 1.3}, (Conductor.stepCrochet * 4 / 1000), {ease: FlxEase.elasticInOut});
|
|
|
|
}
|
|
|
|
|
2020-10-09 21:24:20 +00:00
|
|
|
override function openSubState(SubState:FlxSubState)
|
|
|
|
{
|
|
|
|
if (paused)
|
|
|
|
{
|
2020-10-26 09:16:05 +00:00
|
|
|
if (FlxG.sound.music != null)
|
|
|
|
{
|
|
|
|
FlxG.sound.music.pause();
|
|
|
|
vocals.pause();
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!startTimer.finished)
|
|
|
|
startTimer.active = false;
|
2020-10-09 21:24:20 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
super.openSubState(SubState);
|
|
|
|
}
|
|
|
|
|
|
|
|
override function closeSubState()
|
|
|
|
{
|
|
|
|
if (paused)
|
|
|
|
{
|
2020-12-10 05:04:36 +00:00
|
|
|
if (FlxG.sound.music != null && !startingSong)
|
2020-10-26 09:16:05 +00:00
|
|
|
{
|
2020-12-13 06:42:48 +00:00
|
|
|
resyncVocals();
|
2020-10-26 09:16:05 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
if (!startTimer.finished)
|
|
|
|
startTimer.active = true;
|
2020-10-09 21:24:20 +00:00
|
|
|
paused = false;
|
|
|
|
}
|
|
|
|
|
|
|
|
super.closeSubState();
|
|
|
|
}
|
|
|
|
|
2020-12-13 06:42:48 +00:00
|
|
|
function resyncVocals():Void
|
|
|
|
{
|
|
|
|
vocals.pause();
|
|
|
|
|
|
|
|
FlxG.sound.music.play();
|
|
|
|
Conductor.songPosition = FlxG.sound.music.time;
|
|
|
|
vocals.time = Conductor.songPosition;
|
|
|
|
vocals.play();
|
|
|
|
}
|
|
|
|
|
2020-10-09 21:24:20 +00:00
|
|
|
private var paused:Bool = false;
|
2020-10-23 23:12:38 +00:00
|
|
|
var startedCountdown:Bool = false;
|
2020-11-25 03:53:48 +00:00
|
|
|
var canPause:Bool = true;
|
2020-10-09 21:24:20 +00:00
|
|
|
|
2020-10-03 06:50:15 +00:00
|
|
|
override public function update(elapsed:Float)
|
|
|
|
{
|
2020-12-23 01:55:03 +00:00
|
|
|
#if !debug
|
|
|
|
perfectMode = false;
|
|
|
|
#end
|
|
|
|
|
|
|
|
if (FlxG.keys.justPressed.NINE)
|
|
|
|
{
|
2020-12-24 23:24:11 +00:00
|
|
|
if (iconP1.animation.curAnim.name == 'bf-old')
|
|
|
|
iconP1.animation.play(SONG.player1);
|
|
|
|
else
|
|
|
|
iconP1.animation.play('bf-old');
|
2020-12-23 01:55:03 +00:00
|
|
|
}
|
|
|
|
|
2020-12-10 23:23:53 +00:00
|
|
|
switch (curStage)
|
|
|
|
{
|
|
|
|
case 'philly':
|
|
|
|
if (trainMoving)
|
|
|
|
{
|
|
|
|
trainFrameTiming += elapsed;
|
|
|
|
|
|
|
|
if (trainFrameTiming >= 1 / 24)
|
|
|
|
{
|
|
|
|
updateTrainPos();
|
|
|
|
trainFrameTiming = 0;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-12-13 06:08:21 +00:00
|
|
|
// phillyCityLights.members[curLight].alpha -= (Conductor.crochet / 1000) * FlxG.elapsed;
|
2020-12-10 23:23:53 +00:00
|
|
|
}
|
|
|
|
|
2020-10-03 06:50:15 +00:00
|
|
|
super.update(elapsed);
|
|
|
|
|
2020-11-25 03:53:48 +00:00
|
|
|
scoreTxt.text = "Score:" + songScore;
|
|
|
|
|
|
|
|
if (FlxG.keys.justPressed.ENTER && startedCountdown && canPause)
|
2020-10-09 21:24:20 +00:00
|
|
|
{
|
|
|
|
persistentUpdate = false;
|
|
|
|
persistentDraw = true;
|
|
|
|
paused = true;
|
|
|
|
|
2020-10-30 23:47:19 +00:00
|
|
|
openSubState(new PauseSubState(boyfriend.getScreenPosition().x, boyfriend.getScreenPosition().y));
|
2020-10-09 21:24:20 +00:00
|
|
|
}
|
|
|
|
|
2020-11-07 02:17:27 +00:00
|
|
|
if (FlxG.keys.justPressed.SEVEN)
|
2020-10-14 01:44:07 +00:00
|
|
|
{
|
2020-11-07 02:17:27 +00:00
|
|
|
FlxG.switchState(new ChartingState());
|
2020-10-14 01:44:07 +00:00
|
|
|
}
|
|
|
|
|
2020-10-14 08:30:54 +00:00
|
|
|
// FlxG.watch.addQuick('VOL', vocals.amplitudeLeft);
|
|
|
|
// FlxG.watch.addQuick('VOLRight', vocals.amplitudeRight);
|
2020-10-10 03:22:07 +00:00
|
|
|
|
2020-12-24 23:24:11 +00:00
|
|
|
iconP1.setGraphicSize(Std.int(FlxMath.lerp(150, iconP1.width, 0.50)));
|
|
|
|
iconP2.setGraphicSize(Std.int(FlxMath.lerp(150, iconP2.width, 0.50)));
|
|
|
|
|
|
|
|
iconP1.updateHitbox();
|
|
|
|
iconP2.updateHitbox();
|
2021-01-05 12:53:42 +00:00
|
|
|
|
2020-12-24 23:24:11 +00: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 20:32:41 +00:00
|
|
|
|
2020-11-01 19:16:22 +00:00
|
|
|
if (health > 2)
|
|
|
|
health = 2;
|
|
|
|
|
2020-10-24 09:19:13 +00:00
|
|
|
if (healthBar.percent < 20)
|
2020-12-24 23:24:11 +00:00
|
|
|
iconP1.animation.curAnim.curFrame = 1;
|
2020-10-05 22:29:59 +00:00
|
|
|
else
|
2020-12-24 23:24:11 +00:00
|
|
|
iconP1.animation.curAnim.curFrame = 0;
|
2021-01-14 03:38:31 +00:00
|
|
|
|
|
|
|
if (healthBar.percent > 80)
|
2021-01-15 04:33:12 +00:00
|
|
|
iconP2.animation.curAnim.curFrame = 1;
|
2021-01-01 05:39:58 +00:00
|
|
|
else
|
2021-01-15 04:33:12 +00:00
|
|
|
iconP2.animation.curAnim.curFrame = 0;
|
2021-01-05 12:53:42 +00:00
|
|
|
|
2020-10-19 00:59:53 +00:00
|
|
|
/* if (FlxG.keys.justPressed.NINE)
|
|
|
|
FlxG.switchState(new Charting()); */
|
2020-11-02 06:46:37 +00:00
|
|
|
|
|
|
|
#if debug
|
|
|
|
if (FlxG.keys.justPressed.EIGHT)
|
2020-12-09 22:36:31 +00:00
|
|
|
FlxG.switchState(new AnimationDebug(SONG.player2));
|
2020-11-02 06:46:37 +00:00
|
|
|
#end
|
2020-10-04 06:42:58 +00:00
|
|
|
|
2020-10-23 23:12:38 +00:00
|
|
|
if (startingSong)
|
2020-10-05 18:24:51 +00:00
|
|
|
{
|
2020-10-23 23:12:38 +00:00
|
|
|
if (startedCountdown)
|
|
|
|
{
|
|
|
|
Conductor.songPosition += FlxG.elapsed * 1000;
|
|
|
|
if (Conductor.songPosition >= 0)
|
|
|
|
startSong();
|
|
|
|
}
|
2020-10-05 18:24:51 +00:00
|
|
|
}
|
|
|
|
else
|
2020-10-24 09:19:13 +00:00
|
|
|
{
|
2020-12-02 17:28:28 +00:00
|
|
|
// Conductor.songPosition = FlxG.sound.music.time;
|
2020-11-07 21:13:41 +00:00
|
|
|
Conductor.songPosition += FlxG.elapsed * 1000;
|
2020-10-09 00:54:47 +00:00
|
|
|
|
2020-10-26 09:16:05 +00:00
|
|
|
if (!paused)
|
2020-10-24 09:19:13 +00:00
|
|
|
{
|
2020-10-26 09:16:05 +00:00
|
|
|
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');
|
|
|
|
}
|
2020-10-24 09:19:13 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// Conductor.lastSongPos = FlxG.sound.music.time;
|
|
|
|
}
|
|
|
|
|
2020-10-18 07:27:39 +00:00
|
|
|
if (generatedMusic && PlayState.SONG.notes[Std.int(curStep / 16)] != null)
|
2020-10-03 19:32:15 +00:00
|
|
|
{
|
2020-10-18 07:27:39 +00:00
|
|
|
if (curBeat % 4 == 0)
|
|
|
|
{
|
2020-10-24 09:19:13 +00:00
|
|
|
// trace(PlayState.SONG.notes[Std.int(curStep / 16)].mustHitSection);
|
2020-10-18 07:27:39 +00:00
|
|
|
}
|
|
|
|
|
2020-10-19 00:59:53 +00:00
|
|
|
if (camFollow.x != dad.getMidpoint().x + 150 && !PlayState.SONG.notes[Std.int(curStep / 16)].mustHitSection)
|
2020-10-18 01:47:59 +00:00
|
|
|
{
|
2020-10-19 00:59:53 +00:00
|
|
|
camFollow.setPosition(dad.getMidpoint().x + 150, dad.getMidpoint().y - 100);
|
2020-12-02 17:28:28 +00:00
|
|
|
// camFollow.setPosition(lucky.getMidpoint().x - 120, lucky.getMidpoint().y + 210);
|
2020-12-23 01:55:03 +00:00
|
|
|
if (dad.curCharacter == 'mom')
|
|
|
|
camFollow.y = dad.getMidpoint().y;
|
2020-10-18 01:47:59 +00:00
|
|
|
vocals.volume = 1;
|
2020-10-26 09:16:05 +00:00
|
|
|
|
|
|
|
if (SONG.song.toLowerCase() == 'tutorial')
|
|
|
|
{
|
2020-11-01 01:11:14 +00:00
|
|
|
tweenCamIn();
|
2020-10-26 09:16:05 +00:00
|
|
|
}
|
2020-10-18 01:47:59 +00:00
|
|
|
}
|
2020-10-03 17:36:39 +00:00
|
|
|
|
2020-10-19 00:59:53 +00:00
|
|
|
if (PlayState.SONG.notes[Std.int(curStep / 16)].mustHitSection && camFollow.x != boyfriend.getMidpoint().x - 100)
|
2020-10-18 01:47:59 +00:00
|
|
|
{
|
2020-10-19 00:59:53 +00:00
|
|
|
camFollow.setPosition(boyfriend.getMidpoint().x - 100, boyfriend.getMidpoint().y - 100);
|
2020-10-26 09:16:05 +00:00
|
|
|
|
2021-01-20 03:58:07 +00:00
|
|
|
switch (curStage)
|
2020-12-27 02:46:22 +00:00
|
|
|
{
|
2021-01-20 03:58:07 +00:00
|
|
|
case 'limo':
|
|
|
|
camFollow.x = boyfriend.getMidpoint().x - 300;
|
|
|
|
case 'mall':
|
|
|
|
camFollow.y = boyfriend.getMidpoint().y - 200;
|
2020-12-27 02:46:22 +00:00
|
|
|
}
|
|
|
|
|
2020-10-26 09:16:05 +00:00
|
|
|
if (SONG.song.toLowerCase() == 'tutorial')
|
|
|
|
{
|
|
|
|
FlxTween.tween(FlxG.camera, {zoom: 1}, (Conductor.stepCrochet * 4 / 1000), {ease: FlxEase.elasticInOut});
|
|
|
|
}
|
2020-10-18 01:47:59 +00:00
|
|
|
}
|
2020-10-03 06:50:15 +00:00
|
|
|
}
|
|
|
|
|
2020-10-05 09:48:30 +00:00
|
|
|
if (camZooming)
|
|
|
|
{
|
2020-12-27 02:46:22 +00:00
|
|
|
FlxG.camera.zoom = FlxMath.lerp(defaultCamZoom, FlxG.camera.zoom, 0.95);
|
2020-11-02 06:46:37 +00:00
|
|
|
camHUD.zoom = FlxMath.lerp(1, camHUD.zoom, 0.95);
|
2020-10-05 09:48:30 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
FlxG.watch.addQuick("beatShit", totalBeats);
|
2020-10-03 06:50:15 +00:00
|
|
|
|
2020-10-05 12:55:39 +00:00
|
|
|
if (curSong == 'Fresh')
|
2020-10-05 09:48:30 +00:00
|
|
|
{
|
2020-10-05 12:55:39 +00:00
|
|
|
switch (totalBeats)
|
|
|
|
{
|
|
|
|
case 16:
|
|
|
|
camZooming = true;
|
|
|
|
gfSpeed = 2;
|
|
|
|
case 48:
|
|
|
|
gfSpeed = 1;
|
|
|
|
case 80:
|
|
|
|
gfSpeed = 2;
|
|
|
|
case 112:
|
|
|
|
gfSpeed = 1;
|
2020-10-05 22:29:59 +00:00
|
|
|
case 163:
|
2020-11-01 01:11:14 +00:00
|
|
|
// FlxG.sound.music.stop();
|
|
|
|
// curLevel = 'Bopeebo';
|
|
|
|
// FlxG.switchState(new TitleState());
|
2020-10-05 22:29:59 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (curSong == 'Bopeebo')
|
|
|
|
{
|
|
|
|
switch (totalBeats)
|
|
|
|
{
|
2020-12-06 13:58:32 +00:00
|
|
|
case 128, 129, 130:
|
2020-12-13 06:42:48 +00:00
|
|
|
vocals.volume = 0;
|
2020-11-01 01:11:14 +00:00
|
|
|
// FlxG.sound.music.stop();
|
|
|
|
// curLevel = 'Fresh';
|
|
|
|
// FlxG.switchState(new PlayState());
|
2020-10-05 12:55:39 +00:00
|
|
|
}
|
2020-10-05 09:48:30 +00:00
|
|
|
}
|
|
|
|
// better streaming of shit
|
|
|
|
|
2020-12-02 17:28:28 +00:00
|
|
|
// RESET = Quick Game Over Screen
|
|
|
|
if (controls.RESET)
|
|
|
|
{
|
2020-11-05 10:08:40 +00:00
|
|
|
health = 0;
|
|
|
|
trace("RESET = True");
|
|
|
|
}
|
|
|
|
|
2020-12-02 17:28:28 +00:00
|
|
|
// CHEAT = brandon's a pussy
|
|
|
|
if (controls.CHEAT)
|
|
|
|
{
|
2020-11-05 10:08:40 +00:00
|
|
|
health += 1;
|
|
|
|
trace("User is cheating!");
|
|
|
|
}
|
|
|
|
|
2020-10-05 22:29:59 +00:00
|
|
|
if (health <= 0)
|
|
|
|
{
|
|
|
|
boyfriend.stunned = true;
|
2020-10-30 23:47:19 +00:00
|
|
|
|
|
|
|
persistentUpdate = false;
|
|
|
|
persistentDraw = false;
|
|
|
|
paused = true;
|
|
|
|
|
|
|
|
vocals.stop();
|
|
|
|
FlxG.sound.music.stop();
|
|
|
|
|
|
|
|
openSubState(new GameOverSubstate(boyfriend.getScreenPosition().x, boyfriend.getScreenPosition().y));
|
|
|
|
|
|
|
|
// FlxG.switchState(new GameOverState(boyfriend.getScreenPosition().x, boyfriend.getScreenPosition().y));
|
2020-10-05 22:29:59 +00:00
|
|
|
}
|
|
|
|
|
2020-10-05 10:25:14 +00:00
|
|
|
if (unspawnNotes[0] != null)
|
2020-10-05 09:48:30 +00:00
|
|
|
{
|
2020-10-05 10:53:10 +00:00
|
|
|
if (unspawnNotes[0].strumTime - Conductor.songPosition < 1500)
|
2020-10-05 10:25:14 +00:00
|
|
|
{
|
|
|
|
var dunceNote:Note = unspawnNotes[0];
|
|
|
|
notes.add(dunceNote);
|
|
|
|
|
|
|
|
var index:Int = unspawnNotes.indexOf(dunceNote);
|
|
|
|
unspawnNotes.splice(index, 1);
|
|
|
|
}
|
2020-10-05 09:48:30 +00:00
|
|
|
}
|
2020-10-03 06:50:15 +00:00
|
|
|
|
2020-10-05 18:24:51 +00:00
|
|
|
if (generatedMusic)
|
2020-10-03 06:50:15 +00:00
|
|
|
{
|
2020-10-05 18:24:51 +00:00
|
|
|
notes.forEachAlive(function(daNote:Note)
|
2020-10-04 06:42:58 +00:00
|
|
|
{
|
2020-10-05 18:24:51 +00:00
|
|
|
if (daNote.y > FlxG.height)
|
2020-10-04 06:42:58 +00:00
|
|
|
{
|
2020-10-05 18:24:51 +00:00
|
|
|
daNote.active = false;
|
|
|
|
daNote.visible = false;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
daNote.visible = true;
|
|
|
|
daNote.active = true;
|
2020-10-04 06:42:58 +00:00
|
|
|
}
|
|
|
|
|
2020-10-05 18:24:51 +00:00
|
|
|
if (!daNote.mustPress && daNote.wasGoodHit)
|
|
|
|
{
|
2020-11-02 06:46:37 +00:00
|
|
|
if (SONG.song != 'Tutorial')
|
|
|
|
camZooming = true;
|
|
|
|
|
2021-01-17 09:16:02 +00:00
|
|
|
var altAnim:String = "";
|
|
|
|
|
|
|
|
if (SONG.notes[Math.floor(curStep / 16)] != null)
|
|
|
|
{
|
|
|
|
if (SONG.notes[Math.floor(curStep / 16)].altAnim)
|
|
|
|
altAnim = '-alt';
|
|
|
|
}
|
|
|
|
|
|
|
|
trace("DA ALT THO?: " + SONG.notes[Math.floor(curStep / 16)].altAnim);
|
|
|
|
|
2020-10-05 18:24:51 +00:00
|
|
|
switch (Math.abs(daNote.noteData))
|
|
|
|
{
|
|
|
|
case 2:
|
2021-01-17 09:16:02 +00:00
|
|
|
dad.playAnim('singUP' + altAnim, true);
|
2020-10-05 18:24:51 +00:00
|
|
|
case 3:
|
2021-01-17 09:16:02 +00:00
|
|
|
dad.playAnim('singRIGHT' + altAnim, true);
|
2020-10-17 21:33:35 +00:00
|
|
|
case 1:
|
2021-01-17 09:16:02 +00:00
|
|
|
dad.playAnim('singDOWN' + altAnim, true);
|
2020-10-17 21:33:35 +00:00
|
|
|
case 0:
|
2021-01-17 09:16:02 +00:00
|
|
|
dad.playAnim('singLEFT' + altAnim, true);
|
2020-10-05 18:24:51 +00:00
|
|
|
}
|
2020-10-04 06:42:58 +00:00
|
|
|
|
2020-11-11 10:00:13 +00:00
|
|
|
dad.holdTimer = 0;
|
|
|
|
|
2020-10-30 23:47:19 +00:00
|
|
|
if (SONG.needsVoices)
|
|
|
|
vocals.volume = 1;
|
|
|
|
|
2020-10-05 18:24:51 +00:00
|
|
|
daNote.kill();
|
|
|
|
notes.remove(daNote, true);
|
|
|
|
daNote.destroy();
|
|
|
|
}
|
2020-10-05 05:13:12 +00:00
|
|
|
|
2020-12-24 23:24:11 +00:00
|
|
|
daNote.y = (strumLine.y - (Conductor.songPosition - daNote.strumTime) * (0.45 * FlxMath.roundDecimal(PlayState.SONG.speed, 2)));
|
2020-11-07 02:17:27 +00:00
|
|
|
|
2020-10-26 09:16:05 +00: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 10:25:14 +00:00
|
|
|
|
2020-10-05 18:24:51 +00:00
|
|
|
if (daNote.y < -daNote.height)
|
|
|
|
{
|
2020-12-02 17:28:28 +00:00
|
|
|
if (daNote.tooLate || !daNote.wasGoodHit)
|
2020-10-05 22:29:59 +00:00
|
|
|
{
|
2020-12-11 09:15:24 +00:00
|
|
|
health -= 0.045;
|
2020-10-05 18:24:51 +00:00
|
|
|
vocals.volume = 0;
|
2020-10-05 22:29:59 +00:00
|
|
|
}
|
2020-10-05 10:25:14 +00:00
|
|
|
|
2020-10-05 18:24:51 +00:00
|
|
|
daNote.active = false;
|
|
|
|
daNote.visible = false;
|
2020-10-05 10:25:14 +00:00
|
|
|
|
2020-10-05 18:24:51 +00:00
|
|
|
daNote.kill();
|
|
|
|
notes.remove(daNote, true);
|
|
|
|
daNote.destroy();
|
|
|
|
}
|
|
|
|
});
|
|
|
|
}
|
2020-10-05 10:25:14 +00:00
|
|
|
|
2020-10-05 07:49:53 +00:00
|
|
|
keyShit();
|
2020-10-03 17:36:39 +00:00
|
|
|
}
|
|
|
|
|
2020-11-01 01:11:14 +00:00
|
|
|
function endSong():Void
|
|
|
|
{
|
2020-11-25 03:53:48 +00:00
|
|
|
canPause = false;
|
2021-01-05 12:53:42 +00:00
|
|
|
FlxG.sound.music = new FlxSound();
|
2020-12-04 17:32:35 +00:00
|
|
|
if (SONG.validScore)
|
|
|
|
{
|
|
|
|
#if !switch
|
|
|
|
Highscore.saveScore(SONG.song, songScore, storyDifficulty);
|
|
|
|
#end
|
|
|
|
}
|
2020-11-01 09:55:02 +00:00
|
|
|
|
2020-11-01 01:11:14 +00:00
|
|
|
if (isStoryMode)
|
|
|
|
{
|
2020-11-07 02:17:27 +00:00
|
|
|
campaignScore += songScore;
|
|
|
|
|
2020-11-01 01:11:14 +00:00
|
|
|
storyPlaylist.remove(storyPlaylist[0]);
|
|
|
|
|
|
|
|
if (storyPlaylist.length <= 0)
|
|
|
|
{
|
2020-11-01 19:16:22 +00:00
|
|
|
FlxG.sound.playMusic('assets/music/freakyMenu' + TitleState.soundExt);
|
|
|
|
|
|
|
|
FlxG.switchState(new StoryMenuState());
|
2020-11-01 01:11:14 +00:00
|
|
|
|
2020-12-04 17:36:28 +00:00
|
|
|
// if ()
|
2020-12-11 22:22:22 +00:00
|
|
|
StoryMenuState.weekUnlocked[Std.int(Math.min(storyWeek + 1, StoryMenuState.weekUnlocked.length - 1))] = true;
|
2020-11-01 19:16:22 +00:00
|
|
|
|
2020-12-04 17:36:28 +00:00
|
|
|
if (SONG.validScore)
|
|
|
|
{
|
|
|
|
NGio.unlockMedal(60961);
|
|
|
|
Highscore.saveWeekScore(storyWeek, campaignScore, storyDifficulty);
|
|
|
|
}
|
2020-11-01 09:55:02 +00:00
|
|
|
|
2020-11-01 19:16:22 +00:00
|
|
|
FlxG.save.data.weekUnlocked = StoryMenuState.weekUnlocked;
|
|
|
|
FlxG.save.flush();
|
2020-11-01 01:11:14 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
var difficulty:String = "";
|
|
|
|
|
|
|
|
if (storyDifficulty == 0)
|
|
|
|
difficulty = '-easy';
|
|
|
|
|
|
|
|
if (storyDifficulty == 2)
|
2020-11-10 18:08:18 +00:00
|
|
|
difficulty = '-hard';
|
2020-11-01 01:11:14 +00:00
|
|
|
|
2020-11-07 21:59:25 +00:00
|
|
|
trace('LOADING NEXT SONG');
|
|
|
|
trace(PlayState.storyPlaylist[0].toLowerCase() + difficulty);
|
|
|
|
|
2020-11-01 01:11:14 +00:00
|
|
|
PlayState.SONG = Song.loadFromJson(PlayState.storyPlaylist[0].toLowerCase() + difficulty, PlayState.storyPlaylist[0]);
|
2020-12-17 20:03:33 +00:00
|
|
|
FlxG.sound.music.stop();
|
2020-11-01 01:11:14 +00:00
|
|
|
FlxG.switchState(new PlayState());
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2020-12-27 02:46:22 +00:00
|
|
|
trace('WENT BACK TO FREEPLAY??');
|
2020-11-01 01:11:14 +00:00
|
|
|
FlxG.switchState(new FreeplayState());
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
var endingSong:Bool = false;
|
|
|
|
|
2020-10-19 00:59:53 +00:00
|
|
|
private function popUpScore(strumtime:Float):Void
|
2020-10-03 19:32:15 +00:00
|
|
|
{
|
2020-10-19 00:59:53 +00:00
|
|
|
var noteDiff:Float = Math.abs(strumtime - Conductor.songPosition);
|
|
|
|
// boyfriend.playAnim('hey');
|
2020-10-30 23:47:19 +00:00
|
|
|
vocals.volume = 1;
|
2020-10-04 06:42:58 +00:00
|
|
|
|
2020-10-05 14:03:38 +00:00
|
|
|
var placement:String = Std.string(combo);
|
|
|
|
|
2020-10-03 19:32:15 +00:00
|
|
|
var coolText:FlxText = new FlxText(0, 0, 0, placement, 32);
|
|
|
|
coolText.screenCenter();
|
2020-10-19 00:59:53 +00:00
|
|
|
coolText.x = FlxG.width * 0.55;
|
2020-10-05 14:03:38 +00:00
|
|
|
//
|
|
|
|
|
|
|
|
var rating:FlxSprite = new FlxSprite();
|
2020-11-01 19:16:22 +00:00
|
|
|
var score:Int = 350;
|
2020-10-05 14:03:38 +00:00
|
|
|
|
2020-10-19 00:59:53 +00:00
|
|
|
var daRating:String = "sick";
|
2020-10-05 14:03:38 +00:00
|
|
|
|
2020-10-19 00:59:53 +00:00
|
|
|
if (noteDiff > Conductor.safeZoneOffset * 0.9)
|
|
|
|
{
|
|
|
|
daRating = 'shit';
|
2020-11-01 19:16:22 +00:00
|
|
|
score = 50;
|
2020-10-19 00:59:53 +00:00
|
|
|
}
|
|
|
|
else if (noteDiff > Conductor.safeZoneOffset * 0.75)
|
|
|
|
{
|
2020-10-05 14:03:38 +00:00
|
|
|
daRating = 'bad';
|
2020-11-01 19:16:22 +00:00
|
|
|
score = 100;
|
2020-10-19 00:59:53 +00:00
|
|
|
}
|
|
|
|
else if (noteDiff > Conductor.safeZoneOffset * 0.2)
|
|
|
|
{
|
|
|
|
daRating = 'good';
|
2020-11-01 19:16:22 +00:00
|
|
|
score = 200;
|
2020-10-19 00:59:53 +00:00
|
|
|
}
|
|
|
|
|
2020-11-01 19:16:22 +00:00
|
|
|
songScore += score;
|
|
|
|
|
2020-10-19 00:59:53 +00:00
|
|
|
/* if (combo > 60)
|
|
|
|
daRating = 'sick';
|
|
|
|
else if (combo > 12)
|
|
|
|
daRating = 'good'
|
|
|
|
else if (combo > 4)
|
|
|
|
daRating = 'bad';
|
|
|
|
*/
|
2020-10-05 14:03:38 +00:00
|
|
|
rating.loadGraphic('assets/images/' + daRating + ".png");
|
|
|
|
rating.screenCenter();
|
|
|
|
rating.x = coolText.x - 40;
|
|
|
|
rating.y -= 60;
|
|
|
|
rating.acceleration.y = 550;
|
|
|
|
rating.velocity.y -= FlxG.random.int(140, 175);
|
|
|
|
rating.setGraphicSize(Std.int(rating.width * 0.7));
|
|
|
|
rating.updateHitbox();
|
|
|
|
rating.antialiasing = true;
|
|
|
|
rating.velocity.x -= FlxG.random.int(0, 10);
|
|
|
|
|
2021-01-05 12:53:42 +00:00
|
|
|
var comboSpr:FlxSprite = new FlxSprite().loadGraphic('assets/images/combo.png');
|
2020-10-05 14:03:38 +00:00
|
|
|
comboSpr.screenCenter();
|
|
|
|
comboSpr.x = coolText.x;
|
|
|
|
comboSpr.acceleration.y = 600;
|
|
|
|
comboSpr.antialiasing = true;
|
|
|
|
comboSpr.velocity.y -= 150;
|
|
|
|
comboSpr.setGraphicSize(Std.int(comboSpr.width * 0.7));
|
|
|
|
comboSpr.updateHitbox();
|
|
|
|
comboSpr.velocity.x += FlxG.random.int(1, 10);
|
2020-10-19 00:59:53 +00:00
|
|
|
// add(comboSpr);
|
2020-10-05 14:03:38 +00:00
|
|
|
add(rating);
|
|
|
|
|
|
|
|
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)
|
|
|
|
{
|
|
|
|
var numScore:FlxSprite = new FlxSprite().loadGraphic('assets/images/num' + Std.int(i) + '.png');
|
|
|
|
numScore.screenCenter();
|
2020-10-05 20:32:41 +00:00
|
|
|
numScore.x = coolText.x + (43 * daLoop) - 90;
|
2020-10-05 14:03:38 +00:00
|
|
|
numScore.y += 80;
|
|
|
|
numScore.antialiasing = true;
|
|
|
|
numScore.setGraphicSize(Std.int(numScore.width * 0.5));
|
|
|
|
numScore.updateHitbox();
|
|
|
|
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 19:16:22 +00:00
|
|
|
|
|
|
|
if (combo >= 10 || combo == 0)
|
|
|
|
add(numScore);
|
2020-10-05 14:03:38 +00:00
|
|
|
|
|
|
|
FlxTween.tween(numScore, {alpha: 0}, 0.2, {
|
|
|
|
onComplete: function(tween:FlxTween)
|
|
|
|
{
|
|
|
|
numScore.destroy();
|
|
|
|
},
|
|
|
|
startDelay: Conductor.crochet * 0.002
|
|
|
|
});
|
2020-10-03 19:32:15 +00:00
|
|
|
|
2020-10-05 14:03:38 +00:00
|
|
|
daLoop++;
|
|
|
|
}
|
2020-10-24 09:19:13 +00:00
|
|
|
/*
|
|
|
|
trace(combo);
|
|
|
|
trace(seperatedScore);
|
|
|
|
*/
|
2020-10-05 14:03:38 +00: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 19:32:15 +00:00
|
|
|
onComplete: function(tween:FlxTween)
|
|
|
|
{
|
2020-10-05 10:25:14 +00:00
|
|
|
coolText.destroy();
|
2020-10-05 14:03:38 +00:00
|
|
|
comboSpr.destroy();
|
|
|
|
|
|
|
|
rating.destroy();
|
2020-10-03 19:32:15 +00:00
|
|
|
},
|
|
|
|
startDelay: Conductor.crochet * 0.001
|
|
|
|
});
|
|
|
|
|
|
|
|
curSection += 1;
|
|
|
|
}
|
|
|
|
|
2020-10-05 10:53:10 +00:00
|
|
|
private function keyShit():Void
|
2020-10-03 17:36:39 +00:00
|
|
|
{
|
|
|
|
// HOLDING
|
2020-10-21 23:33:43 +00:00
|
|
|
var up = controls.UP;
|
|
|
|
var right = controls.RIGHT;
|
|
|
|
var down = controls.DOWN;
|
|
|
|
var left = controls.LEFT;
|
|
|
|
|
|
|
|
var upP = controls.UP_P;
|
|
|
|
var rightP = controls.RIGHT_P;
|
|
|
|
var downP = controls.DOWN_P;
|
|
|
|
var leftP = controls.LEFT_P;
|
|
|
|
|
|
|
|
var upR = controls.UP_R;
|
|
|
|
var rightR = controls.RIGHT_R;
|
|
|
|
var downR = controls.DOWN_R;
|
|
|
|
var leftR = controls.LEFT_R;
|
|
|
|
|
2021-01-18 02:23:40 +00:00
|
|
|
var controlArray:Array<Bool> = [leftP, downP, upP, rightP];
|
|
|
|
|
2020-10-24 09:19:13 +00:00
|
|
|
// FlxG.watch.addQuick('asdfa', upP);
|
2020-10-05 18:24:51 +00:00
|
|
|
if ((upP || rightP || downP || leftP) && !boyfriend.stunned && generatedMusic)
|
2020-10-03 17:36:39 +00:00
|
|
|
{
|
2020-11-11 10:00:13 +00:00
|
|
|
boyfriend.holdTimer = 0;
|
|
|
|
|
2020-10-05 03:29:35 +00:00
|
|
|
var possibleNotes:Array<Note> = [];
|
|
|
|
|
2021-01-18 02:23:40 +00:00
|
|
|
var ignoreList:Array<Int> = [];
|
|
|
|
|
2020-10-05 07:49:53 +00:00
|
|
|
notes.forEachAlive(function(daNote:Note)
|
2020-10-03 17:36:39 +00:00
|
|
|
{
|
2020-10-05 07:49:53 +00:00
|
|
|
if (daNote.canBeHit && daNote.mustPress && !daNote.tooLate)
|
2020-10-05 03:29:35 +00:00
|
|
|
{
|
2021-01-18 02:23:40 +00:00
|
|
|
// the sorting probably doesn't need to be in here? who cares lol
|
2020-10-05 03:29:35 +00:00
|
|
|
possibleNotes.push(daNote);
|
2021-01-18 00:06:36 +00:00
|
|
|
possibleNotes.sort((a, b) -> Std.int(a.strumTime - b.strumTime));
|
2021-01-18 02:23:40 +00:00
|
|
|
|
|
|
|
ignoreList.push(daNote.noteData);
|
2020-10-05 03:29:35 +00:00
|
|
|
}
|
|
|
|
});
|
|
|
|
|
|
|
|
if (possibleNotes.length > 0)
|
|
|
|
{
|
2021-01-18 00:06:36 +00:00
|
|
|
var daNote = possibleNotes[0];
|
2020-12-23 01:55:03 +00:00
|
|
|
|
2021-01-18 00:06:36 +00:00
|
|
|
if (perfectMode)
|
|
|
|
noteCheck(true, daNote);
|
2020-10-03 17:36:39 +00:00
|
|
|
|
2021-01-18 02:36:23 +00:00
|
|
|
// Jump notes
|
|
|
|
if (possibleNotes.length >= 2)
|
2021-01-18 00:06:36 +00:00
|
|
|
{
|
2021-01-18 02:36:23 +00:00
|
|
|
if (possibleNotes[0].strumTime == possibleNotes[1].strumTime)
|
2021-01-18 02:23:40 +00:00
|
|
|
{
|
2021-01-18 02:36:23 +00:00
|
|
|
for (coolNote in possibleNotes)
|
2021-01-18 02:23:40 +00:00
|
|
|
{
|
2021-01-18 02:36:23 +00:00
|
|
|
if (controlArray[coolNote.noteData])
|
|
|
|
goodNoteHit(coolNote);
|
|
|
|
else
|
|
|
|
{
|
|
|
|
var inIgnoreList:Bool = false;
|
|
|
|
for (shit in 0...ignoreList.length)
|
|
|
|
{
|
|
|
|
if (controlArray[ignoreList[shit]])
|
|
|
|
inIgnoreList = true;
|
|
|
|
}
|
|
|
|
if (!inIgnoreList)
|
|
|
|
badNoteCheck();
|
|
|
|
}
|
2021-01-18 02:23:40 +00:00
|
|
|
}
|
|
|
|
}
|
2021-01-20 02:09:47 +00:00
|
|
|
else if (possibleNotes[0].noteData == possibleNotes[1].noteData)
|
|
|
|
{
|
2021-01-18 02:36:23 +00:00
|
|
|
noteCheck(controlArray[daNote.noteData], daNote);
|
2021-01-20 02:09:47 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
for (coolNote in possibleNotes)
|
|
|
|
{
|
|
|
|
noteCheck(controlArray[coolNote.noteData], coolNote);
|
|
|
|
}
|
|
|
|
}
|
2021-01-18 02:36:23 +00:00
|
|
|
}
|
|
|
|
else // regular notes?
|
|
|
|
{
|
|
|
|
noteCheck(controlArray[daNote.noteData], daNote);
|
2021-01-18 00:06:36 +00:00
|
|
|
}
|
2021-01-18 02:23:40 +00:00
|
|
|
/*
|
|
|
|
if (controlArray[daNote.noteData])
|
|
|
|
goodNoteHit(daNote);
|
|
|
|
*/
|
|
|
|
// trace(daNote.noteData);
|
|
|
|
/*
|
|
|
|
switch (daNote.noteData)
|
|
|
|
{
|
|
|
|
case 2: // NOTES YOU JUST PRESSED
|
|
|
|
if (upP || rightP || downP || leftP)
|
|
|
|
noteCheck(upP, daNote);
|
|
|
|
case 3:
|
|
|
|
if (upP || rightP || downP || leftP)
|
|
|
|
noteCheck(rightP, daNote);
|
|
|
|
case 1:
|
|
|
|
if (upP || rightP || downP || leftP)
|
|
|
|
noteCheck(downP, daNote);
|
|
|
|
case 0:
|
|
|
|
if (upP || rightP || downP || leftP)
|
|
|
|
noteCheck(leftP, daNote);
|
|
|
|
}
|
|
|
|
*/
|
2021-01-18 00:06:36 +00:00
|
|
|
if (daNote.wasGoodHit)
|
|
|
|
{
|
|
|
|
daNote.kill();
|
|
|
|
notes.remove(daNote, true);
|
|
|
|
daNote.destroy();
|
2020-10-03 17:36:39 +00:00
|
|
|
}
|
2020-10-05 03:29:35 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
badNoteCheck();
|
|
|
|
}
|
2020-10-03 17:36:39 +00:00
|
|
|
}
|
2020-10-04 21:44:52 +00:00
|
|
|
|
2020-10-05 18:24:51 +00:00
|
|
|
if ((up || right || down || left) && !boyfriend.stunned && generatedMusic)
|
2020-10-05 07:49:53 +00:00
|
|
|
{
|
2020-10-24 09:19:13 +00:00
|
|
|
notes.forEachAlive(function(daNote:Note)
|
2020-10-05 07:49:53 +00:00
|
|
|
{
|
2020-10-20 01:59:00 +00:00
|
|
|
if (daNote.canBeHit && daNote.mustPress && daNote.isSustainNote)
|
2020-10-05 07:49:53 +00:00
|
|
|
{
|
|
|
|
switch (daNote.noteData)
|
|
|
|
{
|
|
|
|
// NOTES YOU ARE HOLDING
|
2020-10-20 01:59:00 +00:00
|
|
|
case 2:
|
2021-01-18 00:06:36 +00:00
|
|
|
if (up)
|
2020-10-05 07:49:53 +00:00
|
|
|
goodNoteHit(daNote);
|
2020-10-20 01:59:00 +00:00
|
|
|
case 3:
|
2021-01-18 00:06:36 +00:00
|
|
|
if (right)
|
2020-10-05 07:49:53 +00:00
|
|
|
goodNoteHit(daNote);
|
2020-10-20 01:59:00 +00:00
|
|
|
case 1:
|
2021-01-18 00:06:36 +00:00
|
|
|
if (down)
|
2020-10-05 07:49:53 +00:00
|
|
|
goodNoteHit(daNote);
|
2020-10-20 01:59:00 +00:00
|
|
|
case 0:
|
2021-01-18 00:06:36 +00:00
|
|
|
if (left)
|
2020-10-05 07:49:53 +00:00
|
|
|
goodNoteHit(daNote);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
2020-11-11 10:00:13 +00:00
|
|
|
if (boyfriend.holdTimer > Conductor.stepCrochet * 4 * 0.001 && !up && !down && !right && !left)
|
2020-10-23 23:12:38 +00:00
|
|
|
{
|
2020-11-11 10:00:13 +00:00
|
|
|
if (boyfriend.animation.curAnim.name.startsWith('sing') && !boyfriend.animation.curAnim.name.endsWith('miss'))
|
2020-10-23 23:12:38 +00:00
|
|
|
{
|
|
|
|
boyfriend.playAnim('idle');
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-10-04 21:44:52 +00:00
|
|
|
playerStrums.forEach(function(spr:FlxSprite)
|
|
|
|
{
|
|
|
|
switch (spr.ID)
|
|
|
|
{
|
2020-10-14 02:12:31 +00:00
|
|
|
case 2:
|
2020-10-05 05:13:12 +00:00
|
|
|
if (upP && spr.animation.curAnim.name != 'confirm')
|
2020-10-04 21:44:52 +00:00
|
|
|
spr.animation.play('pressed');
|
|
|
|
if (upR)
|
|
|
|
spr.animation.play('static');
|
2020-10-14 02:12:31 +00:00
|
|
|
case 3:
|
2020-10-05 05:13:12 +00:00
|
|
|
if (rightP && spr.animation.curAnim.name != 'confirm')
|
2020-10-04 21:44:52 +00:00
|
|
|
spr.animation.play('pressed');
|
|
|
|
if (rightR)
|
|
|
|
spr.animation.play('static');
|
2020-10-14 02:12:31 +00:00
|
|
|
case 1:
|
2020-10-05 05:13:12 +00:00
|
|
|
if (downP && spr.animation.curAnim.name != 'confirm')
|
2020-10-04 21:44:52 +00:00
|
|
|
spr.animation.play('pressed');
|
|
|
|
if (downR)
|
|
|
|
spr.animation.play('static');
|
2020-10-14 02:12:31 +00:00
|
|
|
case 0:
|
2020-10-05 05:13:12 +00:00
|
|
|
if (leftP && spr.animation.curAnim.name != 'confirm')
|
2020-10-04 21:44:52 +00:00
|
|
|
spr.animation.play('pressed');
|
|
|
|
if (leftR)
|
|
|
|
spr.animation.play('static');
|
|
|
|
}
|
2020-10-05 10:53:10 +00:00
|
|
|
|
2020-10-04 21:44:52 +00:00
|
|
|
if (spr.animation.curAnim.name == 'confirm')
|
|
|
|
{
|
|
|
|
spr.centerOffsets();
|
|
|
|
spr.offset.x -= 13;
|
|
|
|
spr.offset.y -= 13;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
spr.centerOffsets();
|
|
|
|
});
|
2020-10-03 17:36:39 +00:00
|
|
|
}
|
|
|
|
|
2020-10-05 03:29:35 +00:00
|
|
|
function noteMiss(direction:Int = 1):Void
|
|
|
|
{
|
|
|
|
if (!boyfriend.stunned)
|
|
|
|
{
|
2020-12-11 09:15:24 +00:00
|
|
|
health -= 0.035;
|
2020-10-05 18:24:51 +00:00
|
|
|
if (combo > 5)
|
2020-10-05 14:03:38 +00:00
|
|
|
{
|
|
|
|
gf.playAnim('sad');
|
|
|
|
}
|
|
|
|
combo = 0;
|
|
|
|
|
2020-11-01 19:16:22 +00:00
|
|
|
songScore -= 10;
|
|
|
|
|
2020-10-30 23:47:19 +00:00
|
|
|
FlxG.sound.play('assets/sounds/missnote' + FlxG.random.int(1, 3) + TitleState.soundExt, FlxG.random.float(0.1, 0.2));
|
|
|
|
// FlxG.sound.play('assets/sounds/missnote1' + TitleState.soundExt, 1, false);
|
|
|
|
// FlxG.log.add('played imss note');
|
2020-10-05 07:49:53 +00:00
|
|
|
|
2020-10-05 03:29:35 +00:00
|
|
|
boyfriend.stunned = true;
|
|
|
|
|
|
|
|
// get stunned for 5 seconds
|
|
|
|
new FlxTimer().start(5 / 60, function(tmr:FlxTimer)
|
|
|
|
{
|
|
|
|
boyfriend.stunned = false;
|
|
|
|
});
|
|
|
|
|
|
|
|
switch (direction)
|
|
|
|
{
|
|
|
|
case 2:
|
2020-10-24 09:36:50 +00:00
|
|
|
boyfriend.playAnim('singUPmiss', true);
|
2020-10-05 03:29:35 +00:00
|
|
|
case 3:
|
2020-10-24 09:36:50 +00:00
|
|
|
boyfriend.playAnim('singRIGHTmiss', true);
|
|
|
|
case 1:
|
2020-10-05 03:29:35 +00:00
|
|
|
boyfriend.playAnim('singDOWNmiss', true);
|
2020-10-24 09:36:50 +00:00
|
|
|
case 0:
|
2020-10-05 03:29:35 +00:00
|
|
|
boyfriend.playAnim('singLEFTmiss', true);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
function badNoteCheck()
|
|
|
|
{
|
|
|
|
// just double pasting this shit cuz fuk u
|
2020-10-09 07:29:00 +00:00
|
|
|
// REDO THIS SYSTEM!
|
2020-10-21 23:33:43 +00:00
|
|
|
var upP = controls.UP_P;
|
|
|
|
var rightP = controls.RIGHT_P;
|
|
|
|
var downP = controls.DOWN_P;
|
|
|
|
var leftP = controls.LEFT_P;
|
2020-10-05 03:29:35 +00:00
|
|
|
|
|
|
|
if (leftP)
|
2020-10-14 02:12:31 +00:00
|
|
|
noteMiss(0);
|
2020-10-05 03:29:35 +00:00
|
|
|
if (upP)
|
|
|
|
noteMiss(2);
|
2020-10-14 02:12:31 +00:00
|
|
|
if (rightP)
|
2020-10-05 03:29:35 +00:00
|
|
|
noteMiss(3);
|
2020-10-14 02:12:31 +00:00
|
|
|
if (downP)
|
2020-10-22 00:22:12 +00:00
|
|
|
noteMiss(1);
|
2020-10-05 03:29:35 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
function noteCheck(keyP:Bool, note:Note):Void
|
|
|
|
{
|
|
|
|
if (keyP)
|
|
|
|
goodNoteHit(note);
|
|
|
|
else
|
2021-01-18 00:06:36 +00:00
|
|
|
{
|
2020-10-05 03:29:35 +00:00
|
|
|
badNoteCheck();
|
2021-01-18 00:06:36 +00:00
|
|
|
}
|
2020-10-05 03:29:35 +00:00
|
|
|
}
|
|
|
|
|
2020-10-03 17:36:39 +00:00
|
|
|
function goodNoteHit(note:Note):Void
|
|
|
|
{
|
2020-10-03 19:32:15 +00:00
|
|
|
if (!note.wasGoodHit)
|
|
|
|
{
|
2020-10-30 23:47:19 +00:00
|
|
|
if (!note.isSustainNote)
|
|
|
|
{
|
|
|
|
popUpScore(note.strumTime);
|
|
|
|
combo += 1;
|
|
|
|
}
|
2020-10-05 07:49:53 +00:00
|
|
|
|
2020-10-14 02:12:31 +00:00
|
|
|
if (note.noteData >= 0)
|
2020-11-01 01:11:14 +00:00
|
|
|
health += 0.023;
|
2020-10-05 22:29:59 +00:00
|
|
|
else
|
2020-11-01 01:11:14 +00:00
|
|
|
health += 0.004;
|
2020-10-05 22:29:59 +00:00
|
|
|
|
2020-10-14 02:12:31 +00:00
|
|
|
switch (note.noteData)
|
2020-10-04 06:42:58 +00:00
|
|
|
{
|
|
|
|
case 2:
|
2021-01-20 06:38:39 +00:00
|
|
|
boyfriend.playAnim('singUP', true);
|
2020-10-04 06:42:58 +00:00
|
|
|
case 3:
|
2021-01-20 06:38:39 +00:00
|
|
|
boyfriend.playAnim('singRIGHT', true);
|
2020-10-14 02:12:31 +00:00
|
|
|
case 1:
|
2021-01-20 06:38:39 +00:00
|
|
|
boyfriend.playAnim('singDOWN', true);
|
2020-10-14 02:12:31 +00:00
|
|
|
case 0:
|
2021-01-20 06:38:39 +00:00
|
|
|
boyfriend.playAnim('singLEFT', true);
|
2020-10-04 06:42:58 +00:00
|
|
|
}
|
|
|
|
|
2020-10-04 18:50:12 +00:00
|
|
|
playerStrums.forEach(function(spr:FlxSprite)
|
|
|
|
{
|
|
|
|
if (Math.abs(note.noteData) == spr.ID)
|
|
|
|
{
|
|
|
|
spr.animation.play('confirm', true);
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|
2020-10-03 19:32:15 +00:00
|
|
|
note.wasGoodHit = true;
|
2020-10-04 06:42:58 +00:00
|
|
|
vocals.volume = 1;
|
2020-10-05 22:29:59 +00:00
|
|
|
|
|
|
|
note.kill();
|
|
|
|
notes.remove(note, true);
|
|
|
|
note.destroy();
|
2020-10-03 19:32:15 +00:00
|
|
|
}
|
2020-10-03 06:50:15 +00:00
|
|
|
}
|
|
|
|
|
2020-12-27 10:37:04 +00: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()
|
|
|
|
{
|
|
|
|
FlxG.sound.play('assets/sounds/carPass' + FlxG.random.int(0, 1) + TitleState.soundExt, 0.7);
|
|
|
|
|
|
|
|
fastCar.velocity.x = (FlxG.random.int(170, 220) / FlxG.elapsed) * 3;
|
|
|
|
fastCarCanDrive = false;
|
|
|
|
new FlxTimer().start(2, function(tmr:FlxTimer)
|
|
|
|
{
|
|
|
|
resetFastCar();
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
2020-12-10 23:23:53 +00:00
|
|
|
var trainMoving:Bool = false;
|
|
|
|
var trainFrameTiming:Float = 0;
|
|
|
|
|
|
|
|
var trainCars:Int = 8;
|
|
|
|
var trainFinishing:Bool = false;
|
2020-12-11 13:08:41 +00:00
|
|
|
var trainCooldown:Int = 0;
|
2020-12-10 23:23:53 +00:00
|
|
|
|
|
|
|
function trainStart():Void
|
|
|
|
{
|
|
|
|
trainMoving = true;
|
|
|
|
if (!trainSound.playing)
|
|
|
|
trainSound.play(true);
|
|
|
|
}
|
|
|
|
|
|
|
|
var startedMoving:Bool = false;
|
|
|
|
|
|
|
|
function updateTrainPos():Void
|
|
|
|
{
|
|
|
|
if (trainSound.time >= 4700)
|
|
|
|
{
|
|
|
|
startedMoving = true;
|
2020-12-11 12:55:39 +00:00
|
|
|
gf.playAnim('hairBlow');
|
2020-12-10 23:23:53 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
if (startedMoving)
|
|
|
|
{
|
|
|
|
phillyTrain.x -= 400;
|
|
|
|
|
|
|
|
if (phillyTrain.x < -2000 && !trainFinishing)
|
|
|
|
{
|
|
|
|
phillyTrain.x = -1150;
|
|
|
|
trainCars -= 1;
|
|
|
|
|
|
|
|
if (trainCars <= 0)
|
|
|
|
trainFinishing = true;
|
|
|
|
}
|
|
|
|
|
2020-12-11 09:15:24 +00:00
|
|
|
if (phillyTrain.x < -4000 && trainFinishing)
|
2020-12-10 23:23:53 +00:00
|
|
|
trainReset();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
function trainReset():Void
|
|
|
|
{
|
2020-12-11 12:55:39 +00:00
|
|
|
gf.playAnim('hairFall');
|
2020-12-10 23:23:53 +00:00
|
|
|
phillyTrain.x = FlxG.width + 200;
|
|
|
|
trainMoving = false;
|
|
|
|
// trainSound.stop();
|
|
|
|
// trainSound.time = 0;
|
|
|
|
trainCars = 8;
|
2020-12-11 05:57:42 +00:00
|
|
|
trainFinishing = false;
|
2020-12-10 23:23:53 +00:00
|
|
|
startedMoving = false;
|
|
|
|
}
|
|
|
|
|
2020-11-02 06:46:37 +00:00
|
|
|
function lightningStrikeShit():Void
|
|
|
|
{
|
|
|
|
FlxG.sound.play('assets/sounds/thunder_' + FlxG.random.int(1, 2) + TitleState.soundExt);
|
|
|
|
halloweenBG.animation.play('lightning');
|
|
|
|
|
|
|
|
lightningStrikeBeat = curBeat;
|
|
|
|
lightningOffset = FlxG.random.int(8, 24);
|
|
|
|
|
|
|
|
boyfriend.playAnim('scared', true);
|
|
|
|
gf.playAnim('scared', true);
|
|
|
|
}
|
|
|
|
|
2020-10-10 03:22:07 +00:00
|
|
|
override function stepHit()
|
|
|
|
{
|
2020-10-30 23:47:19 +00:00
|
|
|
if (SONG.needsVoices)
|
2020-10-10 03:22:07 +00:00
|
|
|
{
|
2020-12-13 06:42:48 +00:00
|
|
|
if (vocals.time > Conductor.songPosition + 20 || vocals.time < Conductor.songPosition - 20)
|
2020-10-30 23:47:19 +00:00
|
|
|
{
|
2020-12-13 06:42:48 +00:00
|
|
|
resyncVocals();
|
2020-10-30 23:47:19 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (dad.curCharacter == 'spooky' && totalSteps % 4 == 2)
|
|
|
|
{
|
|
|
|
// dad.dance();
|
2020-10-10 03:22:07 +00:00
|
|
|
}
|
2020-10-30 23:47:19 +00:00
|
|
|
|
2020-10-10 03:22:07 +00:00
|
|
|
super.stepHit();
|
|
|
|
}
|
|
|
|
|
2020-11-02 06:46:37 +00:00
|
|
|
var lightningStrikeBeat:Int = 0;
|
|
|
|
var lightningOffset:Int = 8;
|
|
|
|
|
2020-10-10 02:39:52 +00:00
|
|
|
override function beatHit()
|
2020-10-03 06:50:15 +00:00
|
|
|
{
|
2020-10-10 02:39:52 +00:00
|
|
|
super.beatHit();
|
2020-10-05 09:48:30 +00:00
|
|
|
|
2020-10-24 09:19:13 +00:00
|
|
|
if (generatedMusic)
|
|
|
|
{
|
2020-10-24 09:36:50 +00:00
|
|
|
notes.sort(FlxSort.byY, FlxSort.DESCENDING);
|
2020-10-24 09:19:13 +00:00
|
|
|
}
|
|
|
|
|
2020-11-01 01:11:14 +00:00
|
|
|
if (SONG.notes[Math.floor(curStep / 16)] != null)
|
2020-10-30 23:47:19 +00:00
|
|
|
{
|
2020-11-01 01:11:14 +00:00
|
|
|
if (SONG.notes[Math.floor(curStep / 16)].changeBPM)
|
|
|
|
{
|
|
|
|
Conductor.changeBPM(SONG.notes[Math.floor(curStep / 16)].bpm);
|
|
|
|
FlxG.log.add('CHANGED BPM!');
|
|
|
|
}
|
|
|
|
else
|
|
|
|
Conductor.changeBPM(SONG.bpm);
|
|
|
|
|
|
|
|
// Dad doesnt interupt his own notes
|
|
|
|
if (SONG.notes[Math.floor(curStep / 16)].mustHitSection)
|
|
|
|
dad.dance();
|
2020-10-30 23:47:19 +00:00
|
|
|
}
|
2020-11-01 01:11:14 +00:00
|
|
|
// FlxG.log.add('change bpm' + SONG.notes[Std.int(curStep / 16)].changeBPM);
|
2020-10-30 23:47:19 +00:00
|
|
|
|
2020-12-23 01:55:03 +00:00
|
|
|
// HARDCODING FOR MILF ZOOMS!
|
|
|
|
if (curSong.toLowerCase() == 'milf' && curBeat >= 168 && curBeat <= 200 && camZooming && FlxG.camera.zoom < 1.35)
|
|
|
|
{
|
|
|
|
FlxG.camera.zoom += 0.015;
|
|
|
|
camHUD.zoom += 0.03;
|
|
|
|
}
|
|
|
|
|
2020-10-10 02:39:52 +00:00
|
|
|
if (camZooming && FlxG.camera.zoom < 1.35 && totalBeats % 4 == 0)
|
2020-11-02 06:46:37 +00:00
|
|
|
{
|
|
|
|
FlxG.camera.zoom += 0.015;
|
|
|
|
camHUD.zoom += 0.03;
|
|
|
|
}
|
2020-10-03 17:36:39 +00:00
|
|
|
|
2020-12-24 23:24:11 +00:00
|
|
|
iconP1.setGraphicSize(Std.int(iconP1.width + 30));
|
|
|
|
iconP2.setGraphicSize(Std.int(iconP2.width + 30));
|
|
|
|
|
|
|
|
iconP1.updateHitbox();
|
|
|
|
iconP2.updateHitbox();
|
2020-10-05 12:55:39 +00:00
|
|
|
|
2020-10-10 02:39:52 +00:00
|
|
|
if (totalBeats % gfSpeed == 0)
|
2020-10-30 23:47:19 +00:00
|
|
|
{
|
2020-10-10 02:39:52 +00:00
|
|
|
gf.dance();
|
2020-10-30 23:47:19 +00:00
|
|
|
}
|
2020-10-04 06:42:58 +00:00
|
|
|
|
2020-10-10 02:39:52 +00:00
|
|
|
if (!boyfriend.animation.curAnim.name.startsWith("sing"))
|
2021-01-20 06:38:39 +00:00
|
|
|
{
|
2020-10-10 02:39:52 +00:00
|
|
|
boyfriend.playAnim('idle');
|
2021-01-20 06:38:39 +00:00
|
|
|
}
|
2020-10-30 23:47:19 +00:00
|
|
|
|
2020-11-01 19:16:22 +00:00
|
|
|
if (totalBeats % 8 == 7 && curSong == 'Bopeebo')
|
2020-10-30 23:47:19 +00:00
|
|
|
{
|
|
|
|
boyfriend.playAnim('hey', true);
|
|
|
|
|
|
|
|
if (SONG.song == 'Tutorial' && dad.curCharacter == 'gf')
|
|
|
|
{
|
|
|
|
dad.playAnim('cheer', true);
|
|
|
|
}
|
|
|
|
}
|
2020-11-02 06:46:37 +00:00
|
|
|
|
2020-12-10 23:23:53 +00:00
|
|
|
switch (curStage)
|
|
|
|
{
|
2021-01-20 02:09:47 +00:00
|
|
|
case 'mall':
|
|
|
|
upperBoppers.animation.play('bop', true);
|
|
|
|
bottomBoppers.animation.play('bop', true);
|
2021-01-20 04:29:18 +00:00
|
|
|
santa.animation.play('idle', true);
|
2021-01-20 02:09:47 +00:00
|
|
|
|
2020-12-27 08:13:51 +00:00
|
|
|
case 'limo':
|
|
|
|
grpLimoDancers.forEach(function(dancer:BackgroundDancer)
|
|
|
|
{
|
|
|
|
dancer.dance();
|
|
|
|
});
|
2020-12-27 10:37:04 +00:00
|
|
|
|
|
|
|
if (FlxG.random.bool(10) && fastCarCanDrive)
|
|
|
|
fastCarDrive();
|
2020-12-10 23:23:53 +00:00
|
|
|
case "philly":
|
2020-12-11 13:08:41 +00:00
|
|
|
if (!trainMoving)
|
|
|
|
trainCooldown += 1;
|
|
|
|
|
2020-12-10 23:23:53 +00:00
|
|
|
if (totalBeats % 4 == 0)
|
|
|
|
{
|
|
|
|
phillyCityLights.forEach(function(light:FlxSprite)
|
|
|
|
{
|
|
|
|
light.visible = false;
|
|
|
|
});
|
|
|
|
|
|
|
|
curLight = FlxG.random.int(0, phillyCityLights.length - 1);
|
|
|
|
|
|
|
|
phillyCityLights.members[curLight].visible = true;
|
2020-12-13 06:08:21 +00:00
|
|
|
// phillyCityLights.members[curLight].alpha = 1;
|
2020-12-10 23:23:53 +00:00
|
|
|
}
|
|
|
|
|
2020-12-11 13:08:41 +00:00
|
|
|
if (totalBeats % 8 == 4 && FlxG.random.bool(30) && !trainMoving && trainCooldown > 8)
|
2020-12-10 23:23:53 +00:00
|
|
|
{
|
2020-12-11 13:08:41 +00:00
|
|
|
trainCooldown = FlxG.random.int(-4, 0);
|
2020-12-10 23:23:53 +00:00
|
|
|
trainStart();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-11-02 06:46:37 +00:00
|
|
|
if (isHalloween && FlxG.random.bool(10) && curBeat > lightningStrikeBeat + lightningOffset)
|
|
|
|
{
|
|
|
|
lightningStrikeShit();
|
|
|
|
}
|
2020-10-03 06:50:15 +00:00
|
|
|
}
|
2020-12-10 23:23:53 +00:00
|
|
|
|
|
|
|
var curLight:Int = 0;
|
2020-10-03 06:50:15 +00:00
|
|
|
}
|