2020-10-03 06:50:15 +00:00
|
|
|
package;
|
|
|
|
|
|
|
|
import flixel.FlxG;
|
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-05 18:24:51 +00:00
|
|
|
import flixel.addons.transition.FlxTransitionableState;
|
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-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-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-10-05 22:29:59 +00:00
|
|
|
public static var curLevel:String = 'Bopeebo';
|
|
|
|
|
2020-10-04 06:42:58 +00:00
|
|
|
private var vocals:FlxSound;
|
2020-10-03 17:36:39 +00:00
|
|
|
|
2020-10-04 22:27:49 +00:00
|
|
|
private var dad:Dad;
|
2020-10-05 11:46:57 +00:00
|
|
|
private var gf:Girlfriend;
|
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;
|
|
|
|
|
|
|
|
private var sectionScores:Array<Dynamic> = [[], []];
|
2020-10-05 00:53:49 +00:00
|
|
|
private var sectionLengths:Array<Int> = [];
|
2020-10-03 06:50:15 +00:00
|
|
|
|
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;
|
|
|
|
private var countingDown:Bool = false;
|
|
|
|
|
2020-10-05 20:32:41 +00:00
|
|
|
private var healthHeads:FlxSprite;
|
|
|
|
|
2020-10-03 06:50:15 +00:00
|
|
|
override public function create()
|
|
|
|
{
|
2020-10-05 18:24:51 +00:00
|
|
|
persistentUpdate = true;
|
|
|
|
persistentDraw = true;
|
|
|
|
|
2020-10-05 20:55:48 +00:00
|
|
|
var bg:FlxSprite = new FlxSprite(-600, -200).loadGraphic(AssetPaths.stageback__png);
|
|
|
|
// bg.setGraphicSize(Std.int(bg.width * 2.5));
|
|
|
|
// bg.updateHitbox();
|
2020-10-05 05:13:12 +00:00
|
|
|
bg.antialiasing = true;
|
|
|
|
bg.scrollFactor.set(0.9, 0.9);
|
2020-10-05 10:25:14 +00:00
|
|
|
bg.active = false;
|
2020-10-04 21:44:52 +00:00
|
|
|
add(bg);
|
|
|
|
|
2020-10-05 20:55:48 +00:00
|
|
|
var stageFront:FlxSprite = new FlxSprite(-650, 600).loadGraphic(AssetPaths.stagefront__png);
|
|
|
|
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(AssetPaths.stagecurtains__png);
|
|
|
|
stageCurtains.setGraphicSize(Std.int(stageCurtains.width * 0.9));
|
|
|
|
stageCurtains.updateHitbox();
|
|
|
|
stageCurtains.antialiasing = true;
|
|
|
|
stageCurtains.scrollFactor.set(1.3, 1.3);
|
|
|
|
stageCurtains.active = false;
|
|
|
|
|
2020-10-05 11:46:57 +00:00
|
|
|
gf = new Girlfriend(400, 130);
|
|
|
|
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-10-04 22:27:49 +00:00
|
|
|
dad = new Dad(100, 100);
|
2020-10-03 06:50:15 +00:00
|
|
|
add(dad);
|
|
|
|
|
2020-10-04 18:50:12 +00:00
|
|
|
boyfriend = new Boyfriend(770, 450);
|
2020-10-03 06:50:15 +00:00
|
|
|
add(boyfriend);
|
|
|
|
|
2020-10-05 20:55:48 +00:00
|
|
|
add(stageCurtains);
|
|
|
|
|
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-05 18:24:51 +00:00
|
|
|
var swagCounter:Int = 0;
|
|
|
|
|
2020-10-05 22:29:59 +00:00
|
|
|
generateSong(curLevel.toLowerCase());
|
2020-10-05 18:24:51 +00:00
|
|
|
countingDown = 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
|
|
|
|
|
|
|
new FlxTimer().start(Conductor.crochet / 1000, function(tmr:FlxTimer)
|
|
|
|
{
|
|
|
|
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-04 08:38:21 +00:00
|
|
|
// add(strumLine);
|
2020-10-03 06:50:15 +00:00
|
|
|
|
2020-10-04 06:42:58 +00:00
|
|
|
camFollow = new FlxObject(0, 0, 1, 1);
|
2020-10-05 18:24:51 +00:00
|
|
|
camFollow.setPosition(dad.getGraphicMidpoint().x, dad.getGraphicMidpoint().y);
|
2020-10-04 06:42:58 +00:00
|
|
|
add(camFollow);
|
|
|
|
|
|
|
|
FlxG.camera.follow(camFollow, LOCKON, 0.04);
|
|
|
|
// FlxG.camera.setScrollBounds(0, FlxG.width, 0, FlxG.height);
|
|
|
|
FlxG.camera.zoom = 1.05;
|
|
|
|
|
2020-10-03 19:32:15 +00:00
|
|
|
FlxG.worldBounds.set(0, 0, FlxG.width, FlxG.height);
|
|
|
|
|
2020-10-04 08:38:21 +00:00
|
|
|
FlxG.fixedTimestep = false;
|
|
|
|
|
2020-10-05 20:32:41 +00:00
|
|
|
healthBarBG = new FlxSprite(0, FlxG.height * 0.9).loadGraphic(AssetPaths.healthBar__png);
|
|
|
|
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);
|
|
|
|
|
|
|
|
healthHeads = new FlxSprite();
|
|
|
|
var headTex = FlxAtlasFrames.fromSparrow(AssetPaths.healthHeads__png, AssetPaths.healthHeads__xml);
|
|
|
|
healthHeads.frames = headTex;
|
|
|
|
healthHeads.animation.add('healthy', [0]);
|
|
|
|
healthHeads.animation.add('unhealthy', [1]);
|
|
|
|
healthHeads.y = healthBar.y - (healthHeads.height / 2);
|
|
|
|
healthHeads.scrollFactor.set();
|
2020-10-07 03:59:48 +00:00
|
|
|
healthHeads.antialiasing = true;
|
2020-10-05 20:32:41 +00:00
|
|
|
add(healthHeads);
|
|
|
|
|
2020-10-03 06:50:15 +00:00
|
|
|
super.create();
|
|
|
|
}
|
|
|
|
|
2020-10-05 18:24:51 +00:00
|
|
|
function startSong():Void
|
|
|
|
{
|
|
|
|
countingDown = false;
|
2020-10-07 01:56:33 +00:00
|
|
|
FlxG.sound.playMusic("assets/music/" + curLevel + "_Inst" + TitleState.soundExt);
|
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-05 18:24:51 +00:00
|
|
|
generatedMusic = true;
|
2020-10-04 06:42:58 +00:00
|
|
|
|
2020-10-04 08:38:21 +00:00
|
|
|
generateStaticArrows(0);
|
|
|
|
generateStaticArrows(1);
|
|
|
|
|
2020-10-05 05:13:12 +00:00
|
|
|
var songData = Json.parse(Assets.getText('assets/data/' + dataPath + '/' + dataPath + '.json'));
|
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-07 01:56:33 +00:00
|
|
|
vocals = new FlxSound().loadEmbedded("assets/music/" + curSong + "_Voices" + TitleState.soundExt);
|
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-04 06:42:58 +00:00
|
|
|
var noteData:Array<Dynamic> = [];
|
|
|
|
|
|
|
|
for (i in 1...songData.sections + 1)
|
|
|
|
{
|
|
|
|
noteData.push(ChartParser.parse(songData.song.toLowerCase(), i));
|
|
|
|
}
|
2020-10-03 06:50:15 +00:00
|
|
|
|
|
|
|
var playerCounter:Int = 0;
|
|
|
|
|
|
|
|
while (playerCounter < 2)
|
|
|
|
{
|
|
|
|
var daBeats:Int = 0; // Not exactly representative of 'daBeats' lol, just how much it has looped
|
2020-10-05 00:53:49 +00:00
|
|
|
var totalLength:Int = 0; // Total length of the song, in beats;
|
2020-10-03 06:50:15 +00:00
|
|
|
for (section in noteData)
|
|
|
|
{
|
|
|
|
var dumbassSection:Array<Dynamic> = section;
|
|
|
|
|
|
|
|
var daStep:Int = 0;
|
2020-10-05 00:53:49 +00:00
|
|
|
var coolSection:Int = Std.int(section.length / 4);
|
|
|
|
|
|
|
|
if (coolSection <= 4) // FIX SINCE MOST THE SHIT I MADE WERE ONLY 3 HTINGS LONG LOl
|
|
|
|
coolSection = 4;
|
|
|
|
else if (coolSection <= 8)
|
|
|
|
coolSection = 8;
|
2020-10-03 06:50:15 +00:00
|
|
|
|
|
|
|
for (songNotes in dumbassSection)
|
|
|
|
{
|
2020-10-03 19:32:15 +00:00
|
|
|
sectionScores[0].push(0);
|
|
|
|
sectionScores[1].push(0);
|
|
|
|
|
2020-10-03 06:50:15 +00:00
|
|
|
if (songNotes != 0)
|
|
|
|
{
|
2020-10-05 00:53:49 +00:00
|
|
|
var daStrumTime:Float = ((daStep * Conductor.stepCrochet) + (Conductor.crochet * 8 * totalLength))
|
|
|
|
+ ((Conductor.crochet * coolSection) * playerCounter);
|
2020-10-03 06:50:15 +00:00
|
|
|
|
2020-10-05 05:13:12 +00:00
|
|
|
var oldNote:Note;
|
2020-10-05 09:48:30 +00:00
|
|
|
if (unspawnNotes.length > 0)
|
|
|
|
oldNote = unspawnNotes[Std.int(unspawnNotes.length - 1)];
|
2020-10-05 05:13:12 +00:00
|
|
|
else
|
|
|
|
oldNote = null;
|
|
|
|
|
|
|
|
var swagNote:Note = new Note(daStrumTime, songNotes, oldNote);
|
2020-10-04 06:42:58 +00:00
|
|
|
swagNote.scrollFactor.set(0, 0);
|
2020-10-03 06:50:15 +00:00
|
|
|
|
2020-10-05 09:48:30 +00:00
|
|
|
unspawnNotes.push(swagNote);
|
|
|
|
|
2020-10-03 17:36:39 +00:00
|
|
|
swagNote.x += ((FlxG.width / 2) * playerCounter); // general offset
|
2020-10-03 06:50:15 +00:00
|
|
|
|
2020-10-03 17:36:39 +00:00
|
|
|
if (playerCounter == 1) // is the player
|
2020-10-03 06:50:15 +00:00
|
|
|
{
|
|
|
|
swagNote.mustPress = true;
|
|
|
|
}
|
2020-10-03 19:32:15 +00:00
|
|
|
else
|
|
|
|
{
|
|
|
|
sectionScores[0][daBeats] += swagNote.noteScore;
|
|
|
|
}
|
2020-10-03 06:50:15 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
daStep += 1;
|
|
|
|
}
|
|
|
|
|
2020-10-05 00:53:49 +00:00
|
|
|
// only need to do it once
|
|
|
|
if (playerCounter == 0)
|
|
|
|
sectionLengths.push(Math.round(coolSection / 4));
|
|
|
|
totalLength += Math.round(coolSection / 4);
|
2020-10-03 06:50:15 +00:00
|
|
|
daBeats += 1;
|
|
|
|
}
|
|
|
|
|
2020-10-05 09:48:30 +00:00
|
|
|
trace(unspawnNotes.length);
|
2020-10-03 06:50:15 +00:00
|
|
|
playerCounter += 1;
|
|
|
|
}
|
2020-10-05 09:48:30 +00:00
|
|
|
|
|
|
|
unspawnNotes.sort(sortByShit);
|
|
|
|
}
|
|
|
|
|
|
|
|
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-05 05:13:12 +00:00
|
|
|
var sortedNotes:Bool = false;
|
|
|
|
|
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);
|
|
|
|
var arrTex = FlxAtlasFrames.fromSparrow(AssetPaths.NOTE_assets__png, AssetPaths.NOTE_assets__xml);
|
|
|
|
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-04 08:38:21 +00:00
|
|
|
babyArrow.ID = i + 1;
|
|
|
|
|
|
|
|
if (player == 1)
|
|
|
|
{
|
|
|
|
playerStrums.add(babyArrow);
|
|
|
|
}
|
|
|
|
|
|
|
|
switch (Math.abs(i + 1))
|
|
|
|
{
|
|
|
|
case 1:
|
|
|
|
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-04 08:38:21 +00:00
|
|
|
case 2:
|
|
|
|
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-04 08:38:21 +00:00
|
|
|
case 3:
|
|
|
|
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-04 08:38:21 +00:00
|
|
|
case 4:
|
|
|
|
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-10-03 19:32:15 +00:00
|
|
|
var sectionScored:Bool = false;
|
|
|
|
|
2020-10-09 21:24:20 +00:00
|
|
|
override function openSubState(SubState:FlxSubState)
|
|
|
|
{
|
|
|
|
if (paused)
|
|
|
|
{
|
|
|
|
FlxG.sound.music.pause();
|
|
|
|
vocals.pause();
|
|
|
|
}
|
|
|
|
|
|
|
|
super.openSubState(SubState);
|
|
|
|
}
|
|
|
|
|
|
|
|
override function closeSubState()
|
|
|
|
{
|
|
|
|
if (paused)
|
|
|
|
{
|
|
|
|
vocals.time = FlxG.sound.music.time;
|
|
|
|
|
|
|
|
FlxG.sound.music.play();
|
|
|
|
vocals.play();
|
|
|
|
paused = false;
|
|
|
|
}
|
|
|
|
|
|
|
|
super.closeSubState();
|
|
|
|
}
|
|
|
|
|
|
|
|
private var paused:Bool = false;
|
|
|
|
|
2020-10-03 06:50:15 +00:00
|
|
|
override public function update(elapsed:Float)
|
|
|
|
{
|
|
|
|
super.update(elapsed);
|
|
|
|
|
2020-10-09 21:24:20 +00:00
|
|
|
if (FlxG.keys.justPressed.ENTER)
|
|
|
|
{
|
|
|
|
persistentUpdate = false;
|
|
|
|
persistentDraw = true;
|
|
|
|
paused = true;
|
|
|
|
|
|
|
|
openSubState(new PauseSubState());
|
|
|
|
}
|
|
|
|
|
2020-10-10 03:22:07 +00:00
|
|
|
FlxG.watch.addQuick('VOL', vocals.amplitudeLeft);
|
|
|
|
FlxG.watch.addQuick('VOLRight', vocals.amplitudeRight);
|
|
|
|
|
2020-10-05 20:55:48 +00:00
|
|
|
healthHeads.setGraphicSize(Std.int(FlxMath.lerp(100, healthHeads.width, 0.98)));
|
2020-10-05 20:32:41 +00:00
|
|
|
healthHeads.x = healthBar.x + (healthBar.width * (FlxMath.remapToRange(healthBar.percent, 0, 100, 100, 0) * 0.01)) - (healthHeads.width / 2);
|
|
|
|
|
2020-10-05 22:29:59 +00:00
|
|
|
if (healthBar.percent < 10)
|
|
|
|
healthHeads.animation.play('unhealthy');
|
|
|
|
else
|
|
|
|
healthHeads.animation.play('healthy');
|
|
|
|
/*
|
|
|
|
if (FlxG.keys.justPressed.NINE)
|
|
|
|
FlxG.switchState(new Charting());
|
|
|
|
if (FlxG.keys.justPressed.EIGHT)
|
|
|
|
FlxG.switchState(new Charting(true));
|
|
|
|
*/
|
2020-10-04 06:42:58 +00:00
|
|
|
|
2020-10-05 18:24:51 +00:00
|
|
|
if (countingDown)
|
|
|
|
{
|
|
|
|
Conductor.songPosition += FlxG.elapsed * 1000;
|
|
|
|
|
|
|
|
if (Conductor.songPosition >= 0)
|
|
|
|
startSong();
|
|
|
|
}
|
|
|
|
else
|
|
|
|
Conductor.songPosition = FlxG.sound.music.time;
|
2020-10-09 00:54:47 +00:00
|
|
|
|
|
|
|
var playerTurn:Int = 0;
|
|
|
|
if (sectionLengths.length > curSection)
|
|
|
|
playerTurn = totalBeats % (sectionLengths[curSection] * 8);
|
2020-10-03 06:50:15 +00:00
|
|
|
|
2020-10-05 00:53:49 +00:00
|
|
|
if (playerTurn == (sectionLengths[curSection] * 8) - 1 && !sectionScored)
|
2020-10-03 19:32:15 +00:00
|
|
|
{
|
|
|
|
popUpScore();
|
|
|
|
sectionScored = true;
|
|
|
|
}
|
|
|
|
|
2020-10-05 18:24:51 +00:00
|
|
|
if (playerTurn == 0 && generatedMusic)
|
2020-10-03 19:32:15 +00:00
|
|
|
{
|
2020-10-05 10:25:14 +00:00
|
|
|
if (camFollow.x != dad.getGraphicMidpoint().x + 150)
|
|
|
|
camFollow.setPosition(dad.getGraphicMidpoint().x + 150, dad.getGraphicMidpoint().y - 100);
|
2020-10-04 06:42:58 +00:00
|
|
|
vocals.volume = 1;
|
2020-10-03 19:32:15 +00:00
|
|
|
}
|
2020-10-03 17:36:39 +00:00
|
|
|
|
2020-10-05 10:25:14 +00:00
|
|
|
if (playerTurn == Std.int((sectionLengths[curSection] * 8) / 2) && camFollow.x != boyfriend.getGraphicMidpoint().x - 100)
|
2020-10-03 06:50:15 +00:00
|
|
|
{
|
2020-10-04 06:42:58 +00:00
|
|
|
camFollow.setPosition(boyfriend.getGraphicMidpoint().x - 100, boyfriend.getGraphicMidpoint().y - 100);
|
2020-10-03 06:50:15 +00:00
|
|
|
}
|
|
|
|
|
2020-10-05 09:48:30 +00:00
|
|
|
if (camZooming)
|
|
|
|
{
|
|
|
|
FlxG.camera.zoom = FlxMath.lerp(1.05, FlxG.camera.zoom, 0.96);
|
|
|
|
}
|
|
|
|
|
2020-10-04 06:42:58 +00:00
|
|
|
if (playerTurn < 4)
|
|
|
|
{
|
|
|
|
sectionScored = false;
|
|
|
|
}
|
2020-10-03 06:50:15 +00:00
|
|
|
|
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:
|
|
|
|
FlxG.sound.music.stop();
|
|
|
|
curLevel = 'Bopeebo';
|
|
|
|
FlxG.switchState(new TitleState());
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (curSong == 'Bopeebo')
|
|
|
|
{
|
|
|
|
switch (totalBeats)
|
|
|
|
{
|
|
|
|
case 127:
|
|
|
|
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-10-05 22:29:59 +00:00
|
|
|
if (health <= 0)
|
|
|
|
{
|
|
|
|
boyfriend.stunned = true;
|
|
|
|
FlxG.switchState(new GameOverState());
|
|
|
|
}
|
|
|
|
|
2020-10-05 10:25:14 +00:00
|
|
|
if (unspawnNotes[0] != null)
|
2020-10-05 09:48:30 +00:00
|
|
|
{
|
2020-10-05 10:25:14 +00:00
|
|
|
FlxG.watch.addQuick('spsa', unspawnNotes[0].strumTime);
|
|
|
|
FlxG.watch.addQuick('weed', Conductor.songPosition);
|
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)
|
|
|
|
{
|
|
|
|
switch (Math.abs(daNote.noteData))
|
|
|
|
{
|
|
|
|
case 1:
|
|
|
|
dad.playAnim('singUP');
|
|
|
|
case 2:
|
|
|
|
dad.playAnim('singRIGHT');
|
|
|
|
case 3:
|
|
|
|
dad.playAnim('singDOWN');
|
|
|
|
case 4:
|
|
|
|
dad.playAnim('singLEFT');
|
|
|
|
}
|
2020-10-04 06:42:58 +00:00
|
|
|
|
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-10-05 18:24:51 +00:00
|
|
|
daNote.y = (strumLine.y - (Conductor.songPosition - daNote.strumTime) * 0.45);
|
2020-10-05 10:25:14 +00:00
|
|
|
|
2020-10-05 18:24:51 +00:00
|
|
|
if (daNote.y < -daNote.height)
|
|
|
|
{
|
|
|
|
if (daNote.tooLate)
|
2020-10-05 22:29:59 +00:00
|
|
|
{
|
|
|
|
health -= 0.05;
|
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 07:49:53 +00:00
|
|
|
|
2020-10-05 18:24:51 +00:00
|
|
|
// one time sort
|
|
|
|
if (!sortedNotes)
|
|
|
|
notes.sort(FlxSort.byY, FlxSort.DESCENDING);
|
|
|
|
});
|
|
|
|
}
|
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-10-03 19:32:15 +00:00
|
|
|
private function popUpScore():Void
|
|
|
|
{
|
2020-10-04 21:44:52 +00:00
|
|
|
boyfriend.playAnim('hey');
|
2020-10-04 06:42:58 +00:00
|
|
|
vocals.volume = 1;
|
|
|
|
|
2020-10-05 14:03:38 +00:00
|
|
|
var placement:String = Std.string(combo);
|
|
|
|
// var placement:String = sectionScores[1][curSection] + '/' + sectionScores[0][curSection];
|
|
|
|
|
2020-10-03 19:32:15 +00:00
|
|
|
var coolText:FlxText = new FlxText(0, 0, 0, placement, 32);
|
|
|
|
coolText.screenCenter();
|
|
|
|
coolText.x = FlxG.width * 0.75;
|
2020-10-05 14:03:38 +00:00
|
|
|
//
|
|
|
|
|
|
|
|
var rating:FlxSprite = new FlxSprite();
|
|
|
|
|
|
|
|
var daRating:String = "shit";
|
|
|
|
|
|
|
|
if (combo > 60)
|
|
|
|
daRating = 'sick';
|
|
|
|
else if (combo > 12)
|
|
|
|
daRating = 'good'
|
|
|
|
else if (combo > 4)
|
|
|
|
daRating = 'bad';
|
|
|
|
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);
|
|
|
|
|
|
|
|
var comboSpr:FlxSprite = new FlxSprite().loadGraphic(AssetPaths.combo__png);
|
|
|
|
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);
|
|
|
|
add(comboSpr);
|
|
|
|
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);
|
|
|
|
add(numScore);
|
|
|
|
|
|
|
|
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++;
|
|
|
|
}
|
|
|
|
|
|
|
|
trace(combo);
|
|
|
|
trace(seperatedScore);
|
|
|
|
|
|
|
|
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
|
|
|
|
var up = FlxG.keys.anyPressed([W, UP]);
|
|
|
|
var right = FlxG.keys.anyPressed([D, RIGHT]);
|
|
|
|
var down = FlxG.keys.anyPressed([S, DOWN]);
|
|
|
|
var left = FlxG.keys.anyPressed([A, LEFT]);
|
|
|
|
|
|
|
|
var upP = FlxG.keys.anyJustPressed([W, UP]);
|
|
|
|
var rightP = FlxG.keys.anyJustPressed([D, RIGHT]);
|
|
|
|
var downP = FlxG.keys.anyJustPressed([S, DOWN]);
|
|
|
|
var leftP = FlxG.keys.anyJustPressed([A, LEFT]);
|
|
|
|
|
2020-10-04 08:38:21 +00:00
|
|
|
var upR = FlxG.keys.anyJustReleased([W, UP]);
|
|
|
|
var rightR = FlxG.keys.anyJustReleased([D, RIGHT]);
|
|
|
|
var downR = FlxG.keys.anyJustReleased([S, DOWN]);
|
|
|
|
var leftR = FlxG.keys.anyJustReleased([A, LEFT]);
|
|
|
|
|
2020-10-09 07:29:00 +00:00
|
|
|
var gamepad = FlxG.gamepads.lastActive;
|
|
|
|
if (gamepad != null)
|
|
|
|
{
|
|
|
|
if (gamepad.anyPressed(["DPAD_LEFT", "LEFT_STICK_DIGITAL_LEFT", X]))
|
|
|
|
{
|
|
|
|
left = true;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (gamepad.anyPressed(["DPAD_RIGHT", "LEFT_STICK_DIGITAL_RIGHT", B]))
|
|
|
|
{
|
|
|
|
right = true;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (gamepad.anyPressed(['DPAD_UP', "LEFT_STICK_DIGITAL_UP", Y]))
|
|
|
|
{
|
|
|
|
up = true;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (gamepad.anyPressed(["DPAD_DOWN", "LEFT_STICK_DIGITAL_DOWN", A]))
|
|
|
|
{
|
|
|
|
down = true;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (gamepad.anyJustPressed(["DPAD_LEFT", "LEFT_STICK_DIGITAL_LEFT", X]))
|
|
|
|
{
|
|
|
|
leftP = true;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (gamepad.anyJustPressed(["DPAD_RIGHT", "LEFT_STICK_DIGITAL_RIGHT", B]))
|
|
|
|
{
|
|
|
|
rightP = true;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (gamepad.anyJustPressed(['DPAD_UP', "LEFT_STICK_DIGITAL_UP", Y]))
|
|
|
|
{
|
|
|
|
upP = true;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (gamepad.anyJustPressed(["DPAD_DOWN", "LEFT_STICK_DIGITAL_DOWN", A]))
|
|
|
|
{
|
|
|
|
downP = true;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (gamepad.anyJustReleased(["DPAD_LEFT", "LEFT_STICK_DIGITAL_LEFT", X]))
|
|
|
|
{
|
|
|
|
leftR = true;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (gamepad.anyJustReleased(["DPAD_RIGHT", "LEFT_STICK_DIGITAL_RIGHT", B]))
|
|
|
|
{
|
|
|
|
rightR = true;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (gamepad.anyJustReleased(['DPAD_UP', "LEFT_STICK_DIGITAL_UP", Y]))
|
|
|
|
{
|
|
|
|
upR = true;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (gamepad.anyJustReleased(["DPAD_DOWN", "LEFT_STICK_DIGITAL_DOWN", A]))
|
|
|
|
{
|
|
|
|
downR = true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-10-05 07:49:53 +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-10-05 03:29:35 +00:00
|
|
|
var possibleNotes:Array<Note> = [];
|
|
|
|
|
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
|
|
|
{
|
|
|
|
possibleNotes.push(daNote);
|
2020-10-05 07:49:53 +00:00
|
|
|
trace('NOTE-' + daNote.strumTime + ' ADDED');
|
2020-10-05 03:29:35 +00:00
|
|
|
}
|
|
|
|
});
|
|
|
|
|
|
|
|
if (possibleNotes.length > 0)
|
|
|
|
{
|
|
|
|
for (daNote in possibleNotes)
|
2020-10-03 17:36:39 +00:00
|
|
|
{
|
|
|
|
switch (daNote.noteData)
|
|
|
|
{
|
|
|
|
case 1: // NOTES YOU JUST PRESSED
|
2020-10-05 07:49:53 +00:00
|
|
|
if (upP || rightP || downP || leftP)
|
|
|
|
noteCheck(upP, daNote);
|
2020-10-03 17:36:39 +00:00
|
|
|
case 2:
|
2020-10-05 07:49:53 +00:00
|
|
|
if (upP || rightP || downP || leftP)
|
|
|
|
noteCheck(rightP, daNote);
|
2020-10-03 17:36:39 +00:00
|
|
|
case 3:
|
2020-10-05 07:49:53 +00:00
|
|
|
if (upP || rightP || downP || leftP)
|
|
|
|
noteCheck(downP, daNote);
|
2020-10-03 17:36:39 +00:00
|
|
|
case 4:
|
2020-10-05 07:49:53 +00:00
|
|
|
if (upP || rightP || downP || leftP)
|
|
|
|
noteCheck(leftP, daNote);
|
2020-10-03 17:36:39 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
if (daNote.wasGoodHit)
|
|
|
|
{
|
|
|
|
daNote.kill();
|
2020-10-05 22:29:59 +00:00
|
|
|
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
|
|
|
{
|
|
|
|
notes.forEach(function(daNote:Note)
|
|
|
|
{
|
|
|
|
if (daNote.canBeHit && daNote.mustPress)
|
|
|
|
{
|
|
|
|
switch (daNote.noteData)
|
|
|
|
{
|
|
|
|
// NOTES YOU ARE HOLDING
|
|
|
|
case -1:
|
|
|
|
if (up && daNote.prevNote.wasGoodHit)
|
|
|
|
goodNoteHit(daNote);
|
|
|
|
case -2:
|
|
|
|
if (right && daNote.prevNote.wasGoodHit)
|
|
|
|
goodNoteHit(daNote);
|
|
|
|
case -3:
|
|
|
|
if (down && daNote.prevNote.wasGoodHit)
|
|
|
|
goodNoteHit(daNote);
|
|
|
|
case -4:
|
|
|
|
if (left && daNote.prevNote.wasGoodHit)
|
|
|
|
goodNoteHit(daNote);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
2020-10-04 21:44:52 +00:00
|
|
|
playerStrums.forEach(function(spr:FlxSprite)
|
|
|
|
{
|
|
|
|
switch (spr.ID)
|
|
|
|
{
|
|
|
|
case 1:
|
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');
|
|
|
|
case 2:
|
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');
|
|
|
|
case 3:
|
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');
|
|
|
|
case 4:
|
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-10-05 22:29:59 +00:00
|
|
|
health -= 0.08;
|
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-10-07 01:56:33 +00:00
|
|
|
FlxG.sound.play('assets/sounds/missnote' + FlxG.random.int(1, 3) + TitleState.soundExt, FlxG.random.float(0.05, 0.2));
|
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 1:
|
|
|
|
boyfriend.playAnim('singUPmiss', true);
|
|
|
|
case 2:
|
|
|
|
boyfriend.playAnim('singRIGHTmiss', true);
|
|
|
|
case 3:
|
|
|
|
boyfriend.playAnim('singDOWNmiss', true);
|
|
|
|
case 4:
|
|
|
|
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-05 03:29:35 +00:00
|
|
|
var upP = FlxG.keys.anyJustPressed([W, UP]);
|
|
|
|
var rightP = FlxG.keys.anyJustPressed([D, RIGHT]);
|
|
|
|
var downP = FlxG.keys.anyJustPressed([S, DOWN]);
|
|
|
|
var leftP = FlxG.keys.anyJustPressed([A, LEFT]);
|
|
|
|
|
2020-10-09 07:29:00 +00:00
|
|
|
var gamepad = FlxG.gamepads.lastActive;
|
|
|
|
if (gamepad != null)
|
|
|
|
{
|
|
|
|
if (gamepad.anyJustPressed(["DPAD_LEFT", "LEFT_STICK_DIGITAL_LEFT", X]))
|
|
|
|
{
|
|
|
|
leftP = true;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (gamepad.anyJustPressed(["DPAD_RIGHT", "LEFT_STICK_DIGITAL_RIGHT", B]))
|
|
|
|
{
|
|
|
|
rightP = true;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (gamepad.anyJustPressed(['DPAD_UP', "LEFT_STICK_DIGITAL_UP", Y]))
|
|
|
|
{
|
|
|
|
upP = true;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (gamepad.anyJustPressed(["DPAD_DOWN", "LEFT_STICK_DIGITAL_DOWN", A]))
|
|
|
|
{
|
|
|
|
downP = true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-10-05 03:29:35 +00:00
|
|
|
if (leftP)
|
|
|
|
noteMiss(4);
|
|
|
|
if (upP)
|
|
|
|
noteMiss(1);
|
|
|
|
if (rightP)
|
|
|
|
noteMiss(2);
|
|
|
|
if (downP)
|
|
|
|
noteMiss(3);
|
|
|
|
}
|
|
|
|
|
|
|
|
function noteCheck(keyP:Bool, note:Note):Void
|
|
|
|
{
|
2020-10-05 07:49:53 +00:00
|
|
|
trace(note.noteData + ' note check here ' + keyP);
|
2020-10-05 03:29:35 +00:00
|
|
|
if (keyP)
|
|
|
|
goodNoteHit(note);
|
|
|
|
else
|
|
|
|
badNoteCheck();
|
|
|
|
}
|
|
|
|
|
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-05 14:03:38 +00:00
|
|
|
combo += 1;
|
2020-10-05 07:49:53 +00:00
|
|
|
|
2020-10-05 22:29:59 +00:00
|
|
|
if (note.noteData > 0)
|
|
|
|
health += 0.03;
|
|
|
|
else
|
|
|
|
health += 0.007;
|
|
|
|
|
2020-10-04 06:42:58 +00:00
|
|
|
switch (Math.abs(note.noteData))
|
|
|
|
{
|
|
|
|
case 1:
|
2020-10-04 21:44:52 +00:00
|
|
|
boyfriend.playAnim('singUP');
|
2020-10-04 06:42:58 +00:00
|
|
|
case 2:
|
2020-10-04 21:44:52 +00:00
|
|
|
boyfriend.playAnim('singRIGHT');
|
2020-10-04 06:42:58 +00:00
|
|
|
case 3:
|
2020-10-04 21:44:52 +00:00
|
|
|
boyfriend.playAnim('singDOWN');
|
2020-10-04 06:42:58 +00:00
|
|
|
case 4:
|
2020-10-04 21:44:52 +00:00
|
|
|
boyfriend.playAnim('singLEFT');
|
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
|
|
|
sectionScores[1][curSection] += note.noteScore;
|
|
|
|
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-10-10 03:22:07 +00:00
|
|
|
override function stepHit()
|
|
|
|
{
|
|
|
|
if (vocals.time > Conductor.songPosition + Conductor.stepCrochet || vocals.time < Conductor.songPosition - Conductor.stepCrochet)
|
|
|
|
{
|
|
|
|
vocals.pause();
|
|
|
|
vocals.time = Conductor.songPosition;
|
|
|
|
vocals.play();
|
|
|
|
}
|
|
|
|
super.stepHit();
|
|
|
|
}
|
|
|
|
|
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-10 02:39:52 +00:00
|
|
|
if (camZooming && FlxG.camera.zoom < 1.35 && totalBeats % 4 == 0)
|
|
|
|
FlxG.camera.zoom += 0.025;
|
2020-10-03 17:36:39 +00:00
|
|
|
|
2020-10-10 02:39:52 +00:00
|
|
|
dad.playAnim('idle');
|
|
|
|
healthHeads.setGraphicSize(Std.int(healthHeads.width + 20));
|
2020-10-05 12:55:39 +00:00
|
|
|
|
2020-10-10 02:39:52 +00:00
|
|
|
if (totalBeats % gfSpeed == 0)
|
|
|
|
gf.dance();
|
2020-10-04 06:42:58 +00:00
|
|
|
|
2020-10-10 02:39:52 +00:00
|
|
|
if (!boyfriend.animation.curAnim.name.startsWith("sing"))
|
|
|
|
boyfriend.playAnim('idle');
|
2020-10-03 06:50:15 +00:00
|
|
|
}
|
|
|
|
}
|