diff --git a/Project.xml b/Project.xml
index 5d0c0ee71..37d7467f2 100644
--- a/Project.xml
+++ b/Project.xml
@@ -44,6 +44,8 @@
+
+
@@ -96,4 +98,5 @@
+
diff --git a/source/Alphabet.hx b/source/Alphabet.hx
index bb8cce924..20556e359 100644
--- a/source/Alphabet.hx
+++ b/source/Alphabet.hx
@@ -17,6 +17,8 @@ class Alphabet extends FlxSpriteGroup
public var delay:Float = 0.05;
public var paused:Bool = false;
+ public var text:String = "";
+
var _finalText:String = "";
var _curText:String = "";
@@ -28,15 +30,79 @@ class Alphabet extends FlxSpriteGroup
// amp, backslash, question mark, apostrophy, comma, angry faic, period
var lastSprite:AlphaCharacter;
var xPosResetted:Bool = false;
+ var lastWasSpace:Bool = false;
- public function new(x:Float, y:Float, text:String = "", ?bold:Bool = false)
+ var splitWords:Array = [];
+
+ public function new(x:Float, y:Float, text:String = "", ?bold:Bool = false, typed:Bool = false)
{
super(x, y);
_finalText = text;
+ this.text = text;
- var arrayShit:Array = text.split("");
- trace(arrayShit);
+ if (typed)
+ {
+ startTypedText();
+ }
+ else
+ {
+ addText();
+ }
+ }
+
+ public function addText()
+ {
+ doSplitWords();
+
+ for (character in splitWords)
+ {
+ // if (character.fastCodeAt() == " ")
+ // {
+ // }
+
+ if (character == " ")
+ {
+ lastWasSpace = true;
+ }
+
+ if (AlphaCharacter.alphabet.contains(character.toLowerCase()))
+ {
+ var xPos:Float = 0;
+ if (lastSprite != null)
+ {
+ xPos = lastSprite.x + lastSprite.frameWidth;
+ }
+
+ if (lastWasSpace)
+ {
+ xPos += 40;
+ lastWasSpace = false;
+ }
+
+ // var letter:AlphaCharacter = new AlphaCharacter(30 * loopNum, 0);
+ var letter:AlphaCharacter = new AlphaCharacter(xPos, 0);
+ letter.createBold(character);
+ add(letter);
+
+ lastSprite = letter;
+ }
+
+ // loopNum += 1;
+ }
+ }
+
+ function doSplitWords():Void
+ {
+ splitWords = _finalText.split("");
+ }
+
+ public function startTypedText():Void
+ {
+ _finalText = text;
+ doSplitWords();
+
+ // trace(arrayShit);
var loopNum:Int = 0;
@@ -52,7 +118,7 @@ class Alphabet extends FlxSpriteGroup
// xPos = 0;
}
- if (AlphaCharacter.alphabet.contains(arrayShit[loopNum].toLowerCase()))
+ if (AlphaCharacter.alphabet.contains(splitWords[loopNum].toLowerCase()))
{
if (lastSprite != null && !xPosResetted)
{
@@ -67,7 +133,7 @@ class Alphabet extends FlxSpriteGroup
// var letter:AlphaCharacter = new AlphaCharacter(30 * loopNum, 0);
var letter:AlphaCharacter = new AlphaCharacter(xPos, 55 * yMulti);
- letter.createBold(arrayShit[loopNum]);
+ letter.createBold(splitWords[loopNum]);
add(letter);
lastSprite = letter;
@@ -76,32 +142,7 @@ class Alphabet extends FlxSpriteGroup
loopNum += 1;
tmr.time = FlxG.random.float(0.03, 0.09);
- }, arrayShit.length);
-
- for (character in arrayShit)
- {
- // if (character.fastCodeAt() == " ")
- // {
- // }
-
- if (AlphaCharacter.alphabet.contains(character.toLowerCase()))
- {
- /* var xPos:Float = 0;
- if (lastSprite != null)
- {
- xPos = lastSprite.x + lastSprite.frameWidth - 40;
- }
-
- // var letter:AlphaCharacter = new AlphaCharacter(30 * loopNum, 0);
- var letter:AlphaCharacter = new AlphaCharacter(xPos, 0);
- letter.createBold(character);
- add(letter);
-
- lastSprite = letter; */
- }
-
- // loopNum += 1;
- }
+ }, splitWords.length);
}
override function update(elapsed:Float)
diff --git a/source/AnimationDebug.hx b/source/AnimationDebug.hx
index ae3ca510e..e74b45c56 100644
--- a/source/AnimationDebug.hx
+++ b/source/AnimationDebug.hx
@@ -39,6 +39,9 @@ class AnimationDebug extends FlxState
gridBG.scrollFactor.set(0.5, 0.5);
add(gridBG);
+ if (daAnim == 'bf')
+ isDad = false;
+
if (isDad)
{
dad = new Character(0, 0, daAnim);
diff --git a/source/Boyfriend.hx b/source/Boyfriend.hx
index 4796b8549..483f4d0e6 100644
--- a/source/Boyfriend.hx
+++ b/source/Boyfriend.hx
@@ -26,6 +26,10 @@ class Boyfriend extends Character
animation.addByPrefix('singRIGHTmiss', 'BF NOTE RIGHT MISS', 24, false);
animation.addByPrefix('singDOWNmiss', 'BF NOTE DOWN MISS', 24, false);
animation.addByPrefix('hey', 'BF HEY', 24, false);
+
+ animation.addByPrefix('firstDeath', "BF dies", 24, false);
+ animation.addByPrefix('deathLoop', "BF Dead Loop", 24, true);
+ animation.addByPrefix('deathConfirm', "BF Dead confirm", 24, false);
playAnim('idle');
antialiasing = true;
@@ -40,6 +44,9 @@ class Boyfriend extends Character
addOffset("singLEFTmiss", 12, 24);
addOffset("singDOWNmiss", -11, -19);
addOffset("hey", 7, 4);
+ addOffset('firstDeath', 37, 11);
+ addOffset('deathLoop', 37, 5);
+ addOffset('deathConfirm', 37, 69);
}
override function update(elapsed:Float)
@@ -48,6 +55,12 @@ class Boyfriend extends Character
{
playAnim('idle', true, false, 10);
}
+
+ if (animation.curAnim.name == 'firstDeath' && animation.curAnim.finished)
+ {
+ playAnim('deathLoop');
+ }
+
super.update(elapsed);
}
}
diff --git a/source/ButtonRemapSubstate.hx b/source/ButtonRemapSubstate.hx
new file mode 100644
index 000000000..64ff07948
--- /dev/null
+++ b/source/ButtonRemapSubstate.hx
@@ -0,0 +1,11 @@
+package;
+
+import flixel.FlxSubState;
+
+class ButtonRemapSubstate extends FlxSubState
+{
+ public function new()
+ {
+ super();
+ }
+}
diff --git a/source/Character.hx b/source/Character.hx
index 85df3268f..af441f023 100644
--- a/source/Character.hx
+++ b/source/Character.hx
@@ -73,7 +73,7 @@ class Character extends FlxSprite
animation.addByPrefix('singDOWN', 'spooky DOWN note', 24, false);
animation.addByPrefix('singLEFT', 'note sing left', 24, false);
animation.addByPrefix('singRIGHT', 'spooky sing right', 24, false);
- animation.addByIndices('danceLeft', 'spooky dance idle', [16, 0, 2, 6], "", 12, false);
+ animation.addByIndices('danceLeft', 'spooky dance idle', [0, 2, 6], "", 12, false);
animation.addByIndices('danceRight', 'spooky dance idle', [8, 10, 12, 14], "", 12, false);
addOffset('danceLeft');
@@ -85,6 +85,21 @@ class Character extends FlxSprite
addOffset("singDOWN", -50, -130);
playAnim('danceRight');
+ case 'monster':
+ tex = FlxAtlasFrames.fromSparrow(AssetPaths.Monster_Assets__png, AssetPaths.Monster_Assets__xml);
+ frames = tex;
+ animation.addByPrefix('idle', 'monster idle', 24);
+ animation.addByPrefix('singUP', 'monster up note', 24, false);
+ animation.addByPrefix('singDOWN', 'monster down', 24, false);
+ animation.addByPrefix('singLEFT', 'Monster left note', 24, false);
+ animation.addByPrefix('singRIGHT', 'Monster Right note', 24, false);
+
+ addOffset('idle');
+ addOffset("singUP", -20, 50);
+ addOffset("singRIGHT", -51);
+ addOffset("singLEFT", -30);
+ addOffset("singDOWN", -30, -40);
+ playAnim('idle');
}
}
@@ -113,6 +128,8 @@ class Character extends FlxSprite
playAnim('danceLeft');
case 'dad':
playAnim('idle');
+ case 'monster':
+ playAnim('idle');
}
}
@@ -125,6 +142,23 @@ class Character extends FlxSprite
{
offset.set(daOffset[0], daOffset[1]);
}
+
+ if (curCharacter == 'gf')
+ {
+ if (AnimName == 'singLEFT')
+ {
+ danced = true;
+ }
+ else if (AnimName == 'singRIGHT')
+ {
+ danced = false;
+ }
+
+ if (AnimName == 'singUP' || AnimName == 'singDOWN')
+ {
+ danced = !danced;
+ }
+ }
}
public function addOffset(name:String, x:Float = 0, y:Float = 0)
diff --git a/source/ChartingState.hx b/source/ChartingState.hx
index 87d0409f4..a4cf96c92 100644
--- a/source/ChartingState.hx
+++ b/source/ChartingState.hx
@@ -1,5 +1,6 @@
package;
+import Section.SwagSection;
import Song.SwagSong;
import flixel.FlxG;
import flixel.FlxSprite;
@@ -68,6 +69,8 @@ class ChartingState extends MusicBeatState
**/
var curSelectedNote:Array;
+ var tempBpm:Int = 0;
+
override function create()
{
gridBG = FlxGridOverlay.create(GRID_SIZE, GRID_SIZE, GRID_SIZE * 8, GRID_SIZE * 16);
@@ -81,9 +84,9 @@ class ChartingState extends MusicBeatState
else
{
_song = {
- song: 'tutorial',
+ song: 'Monster',
notes: [],
- bpm: 100,
+ bpm: 95,
sections: 0,
needsVoices: false,
player1: 'bf',
@@ -93,6 +96,8 @@ class ChartingState extends MusicBeatState
};
}
+ tempBpm = _song.bpm;
+
addSection();
// sections = _song.notes;
@@ -172,7 +177,7 @@ class ChartingState extends MusicBeatState
stepperBPM.value = Conductor.bpm;
stepperBPM.name = 'song_bpm';
- var characters:Array = ["bf", 'dad', 'gf', 'spooky'];
+ var characters:Array = ["bf", 'dad', 'gf', 'spooky', 'monster'];
var player1DropDown = new FlxUIDropDownMenu(10, 100, FlxUIDropDownMenu.makeStrIdLabelArray(characters, true), function(character:String)
{
@@ -208,6 +213,8 @@ class ChartingState extends MusicBeatState
var stepperLength:FlxUINumericStepper;
var check_mustHitSection:FlxUICheckBox;
+ var check_changeBPM:FlxUICheckBox;
+ var stepperSectionBPM:FlxUINumericStepper;
function addSectionUI():Void
{
@@ -218,7 +225,11 @@ class ChartingState extends MusicBeatState
stepperLength.value = _song.notes[curSection].lengthInSteps;
stepperLength.name = "section_length";
- var stepperCopy:FlxUINumericStepper = new FlxUINumericStepper(110, 30, 1, 1, 1, 999, 0);
+ stepperSectionBPM = new FlxUINumericStepper(10, 80, 1, Conductor.bpm, 0, 999, 0);
+ stepperSectionBPM.value = Conductor.bpm;
+ stepperSectionBPM.name = 'section_bpm';
+
+ var stepperCopy:FlxUINumericStepper = new FlxUINumericStepper(110, 30, 1, 1, -999, 999, 0);
var copyButton:FlxButton = new FlxButton(110, 8, "Copy last section", function()
{
@@ -229,15 +240,15 @@ class ChartingState extends MusicBeatState
check_mustHitSection.name = 'check_mustHit';
check_mustHitSection.checked = true;
// _song.needsVoices = check_mustHit.checked;
- check_mustHitSection.callback = function()
- {
- // _song.needsVoices = check_mustHit.checked;
- trace('CHECKED!');
- };
+
+ check_changeBPM = new FlxUICheckBox(10, 60, null, null, 'Change BPM', 100);
+ check_changeBPM.name = 'check_changeBPM';
tab_group_section.add(stepperLength);
+ tab_group_section.add(stepperSectionBPM);
tab_group_section.add(stepperCopy);
tab_group_section.add(check_mustHitSection);
+ tab_group_section.add(check_changeBPM);
tab_group_section.add(copyButton);
UI_box.addGroup(tab_group_section);
@@ -267,7 +278,7 @@ class ChartingState extends MusicBeatState
if (FlxG.sound.music != null)
FlxG.sound.music.stop();
- FlxG.sound.playMusic('assets/music/' + daSong + '.mp3', 0.6);
+ FlxG.sound.playMusic('assets/music/' + daSong + TitleState.soundExt, 0.6);
FlxG.sound.music.pause();
FlxG.sound.music.onComplete = function()
{
@@ -305,6 +316,9 @@ class ChartingState extends MusicBeatState
{
case 'Must hit section':
_song.notes[curSection].mustHitSection = check.checked;
+ case 'Change BPM':
+ _song.notes[curSection].changeBPM = check.checked;
+ FlxG.log.add('changed bpm shit');
}
}
else if (id == FlxUINumericStepper.CHANGE_EVENT && (sender is FlxUINumericStepper))
@@ -323,6 +337,7 @@ class ChartingState extends MusicBeatState
}
else if (wname == 'song_bpm')
{
+ tempBpm = Std.int(nums.value);
Conductor.changeBPM(Std.int(nums.value));
}
else if (wname == 'note_susLength')
@@ -330,6 +345,11 @@ class ChartingState extends MusicBeatState
curSelectedNote[2] = nums.value;
updateGrid();
}
+ else if (wname == 'section_bpm')
+ {
+ _song.notes[curSection].bpm = Std.int(nums.value);
+ updateGrid();
+ }
}
// FlxG.log.add(id + " WEED " + sender + " WEED " + data + " WEED " + params);
@@ -448,12 +468,12 @@ class ChartingState extends MusicBeatState
}
}
- _song.bpm = Conductor.bpm;
+ _song.bpm = tempBpm;
- if (FlxG.keys.justPressed.UP)
- Conductor.changeBPM(Conductor.bpm + 1);
- if (FlxG.keys.justPressed.DOWN)
- Conductor.changeBPM(Conductor.bpm - 1);
+ /* if (FlxG.keys.justPressed.UP)
+ Conductor.changeBPM(Conductor.bpm + 1);
+ if (FlxG.keys.justPressed.DOWN)
+ Conductor.changeBPM(Conductor.bpm - 1); */
if (FlxG.keys.justPressed.RIGHT)
changeSection(curSection + 1);
@@ -471,6 +491,7 @@ class ChartingState extends MusicBeatState
if (_song.notes[sec] != null)
{
curSection = sec;
+
updateGrid();
if (updateMusic)
@@ -489,6 +510,7 @@ class ChartingState extends MusicBeatState
updateCurStep();
}
+ updateGrid();
updateSectionUI();
}
}
@@ -514,6 +536,8 @@ class ChartingState extends MusicBeatState
stepperLength.value = sec.lengthInSteps;
check_mustHitSection.checked = sec.mustHitSection;
+ check_changeBPM.checked = sec.changeBPM;
+ stepperSectionBPM.value = sec.bpm;
}
function updateNoteUI():Void
@@ -535,6 +559,15 @@ class ChartingState extends MusicBeatState
var sectionInfo:Array = _song.notes[curSection].sectionNotes;
+ if (_song.notes[curSection].changeBPM && _song.notes[curSection].bpm > 0)
+ {
+ Conductor.changeBPM(_song.notes[curSection].bpm);
+ }
+ else
+ {
+ Conductor.changeBPM(tempBpm);
+ }
+
/* // PORT BULLSHIT, INCASE THERE'S NO SUSTAIN DATA FOR A NOTE
for (sec in 0..._song.notes.length)
{
@@ -567,8 +600,7 @@ class ChartingState extends MusicBeatState
if (daSus > 0)
{
var sustainVis:FlxSprite = new FlxSprite(note.x + (GRID_SIZE / 2),
- note.y + getYfromStrum(note.strumTime + Conductor.stepCrochet)).makeGraphic(8,
- Math.floor(FlxMath.remapToRange(daSus, 0, Conductor.stepCrochet * 16, 0, gridBG.height)));
+ note.y + GRID_SIZE).makeGraphic(8, Math.floor(FlxMath.remapToRange(daSus, 0, Conductor.stepCrochet * 16, 0, gridBG.height)));
curRenderedSustains.add(sustainVis);
}
}
@@ -576,7 +608,16 @@ class ChartingState extends MusicBeatState
private function addSection(lengthInSteps:Int = 16):Void
{
- _song.notes.push(new Section(lengthInSteps));
+ var sec:SwagSection = {
+ lengthInSteps: lengthInSteps,
+ bpm: _song.bpm,
+ changeBPM: false,
+ mustHitSection: true,
+ sectionNotes: [],
+ typeOfSection: 0
+ };
+
+ _song.notes.push(sec);
}
function selectNote(note:Note):Void
@@ -611,6 +652,16 @@ class ChartingState extends MusicBeatState
updateGrid();
}
+ function clearSong():Void
+ {
+ for (daSection in 0..._song.notes.length)
+ {
+ _song.notes[daSection].sectionNotes = [];
+ }
+
+ updateGrid();
+ }
+
private function addNote():Void
{
var noteStrum = Math.round(getStrumTime(dummyArrow.y) + (curSection * (Conductor.stepCrochet * 16)));
@@ -638,7 +689,7 @@ class ChartingState extends MusicBeatState
return FlxMath.remapToRange(strumTime, 0, 16 * Conductor.stepCrochet, gridBG.y, gridBG.y + gridBG.height);
}
- function calculateSectionLengths(?sec:Section):Int
+ function calculateSectionLengths(?sec:SwagSection):Int
{
var daLength:Int = 0;
diff --git a/source/FreeplayState.hx b/source/FreeplayState.hx
index 626e40256..f2a717fec 100644
--- a/source/FreeplayState.hx
+++ b/source/FreeplayState.hx
@@ -14,7 +14,7 @@ import flixel.text.FlxText;
class FreeplayState extends MusicBeatState
{
- var songs:Array = ["Bopeebo", "Dadbattle", "Fresh", "Tutorial\nlol"];
+ var songs:Array = ["Bopeebo", "Dadbattle", "Fresh", "Tutorial", "Spookeez", "South", "Monster"];
var selector:FlxText;
var curSelected:Int = 0;
@@ -30,11 +30,17 @@ class FreeplayState extends MusicBeatState
for (i in 0...songs.length)
{
- var songText:Alphabet = new Alphabet(40, (70 * i) + 30, songs[i]);
+ var songText:Alphabet = new Alphabet(0, (70 * i) + 30, songs[i], true, false);
add(songText);
+ songText.x += 40;
+ // DONT PUT X IN THE FIRST PARAMETER OF new ALPHABET() !!
+ // songText.screenCenter(X);
}
+ FlxG.sound.playMusic('assets/music/title' + TitleState.soundExt, 0);
+ FlxG.sound.music.fadeIn(2, 0, 0.8);
selector = new FlxText();
+
selector.size = 40;
selector.text = ">";
add(selector);
@@ -46,11 +52,16 @@ class FreeplayState extends MusicBeatState
override function update(elapsed:Float)
{
- if (FlxG.keys.justPressed.UP)
+ super.update(elapsed);
+ var upP = controls.UP_P;
+ var downP = controls.DOWN_P;
+ var accepted = controls.ACCEPT;
+
+ if (upP)
{
curSelected -= 1;
}
- if (FlxG.keys.justPressed.DOWN)
+ if (downP)
{
curSelected += 1;
}
@@ -73,10 +84,11 @@ class FreeplayState extends MusicBeatState
selector.y = (70 * curSelected) + 30;
- if (FlxG.keys.justPressed.ENTER)
+ if (accepted)
{
PlayState.SONG = Song.loadFromJson(songs[curSelected].toLowerCase());
FlxG.switchState(new PlayState());
+ FlxG.sound.music.stop();
}
#if switch
@@ -84,9 +96,8 @@ class FreeplayState extends MusicBeatState
{
PlayState.SONG = Song.loadFromJson(songs[curSelected].toLowerCase());
FlxG.switchState(new PlayState());
+ FlxG.sound.music.stop();
}
#end
-
- super.update(elapsed);
}
}
diff --git a/source/GameOverState.hx b/source/GameOverState.hx
index d3de48311..064325478 100644
--- a/source/GameOverState.hx
+++ b/source/GameOverState.hx
@@ -10,26 +10,44 @@ import flixel.tweens.FlxTween;
class GameOverState extends FlxTransitionableState
{
+ var bfX:Float = 0;
+ var bfY:Float = 0;
+
+ public function new(x:Float, y:Float)
+ {
+ super();
+
+ bfX = x;
+ bfY = y;
+ }
+
override function create()
{
- var loser:FlxSprite = new FlxSprite(100, 100);
- var loseTex = FlxAtlasFrames.fromSparrow(AssetPaths.lose__png, AssetPaths.lose__xml);
- loser.frames = loseTex;
- loser.animation.addByPrefix('lose', 'lose', 24, false);
- loser.animation.play('lose');
- add(loser);
+ /* var loser:FlxSprite = new FlxSprite(100, 100);
+ var loseTex = FlxAtlasFrames.fromSparrow(AssetPaths.lose__png, AssetPaths.lose__xml);
+ loser.frames = loseTex;
+ loser.animation.addByPrefix('lose', 'lose', 24, false);
+ loser.animation.play('lose');
+ // add(loser); */
- var restart:FlxSprite = new FlxSprite(500, 50).loadGraphic(AssetPaths.restart__png);
- restart.setGraphicSize(Std.int(restart.width * 0.6));
- restart.updateHitbox();
- restart.alpha = 0;
- restart.antialiasing = true;
- add(restart);
+ var bf:Boyfriend = new Boyfriend(bfX, bfY);
+ // bf.scrollFactor.set();
+ add(bf);
+ bf.playAnim('firstDeath');
+
+ FlxG.camera.follow(bf, LOCKON, 0.001);
+ /*
+ var restart:FlxSprite = new FlxSprite(500, 50).loadGraphic(AssetPaths.restart__png);
+ restart.setGraphicSize(Std.int(restart.width * 0.6));
+ restart.updateHitbox();
+ restart.alpha = 0;
+ restart.antialiasing = true;
+ // add(restart); */
FlxG.sound.music.fadeOut(2, FlxG.sound.music.volume * 0.6);
- FlxTween.tween(restart, {alpha: 1}, 1, {ease: FlxEase.quartInOut});
- FlxTween.tween(restart, {y: restart.y + 40}, 7, {ease: FlxEase.quartInOut, type: PINGPONG});
+ // FlxTween.tween(restart, {alpha: 1}, 1, {ease: FlxEase.quartInOut});
+ // FlxTween.tween(restart, {y: restart.y + 40}, 7, {ease: FlxEase.quartInOut, type: PINGPONG});
super.create();
}
@@ -48,6 +66,8 @@ class GameOverState extends FlxTransitionableState
pressed = true;
}
+ pressed = false;
+
if (pressed && !fading)
{
fading = true;
diff --git a/source/GameOverSubstate.hx b/source/GameOverSubstate.hx
new file mode 100644
index 000000000..1a7d89d58
--- /dev/null
+++ b/source/GameOverSubstate.hx
@@ -0,0 +1,89 @@
+package;
+
+import flixel.FlxG;
+import flixel.FlxObject;
+import flixel.FlxSubState;
+import flixel.math.FlxPoint;
+import flixel.util.FlxColor;
+import flixel.util.FlxTimer;
+
+class GameOverSubstate extends MusicBeatSubstate
+{
+ var bf:Boyfriend;
+ var camFollow:FlxObject;
+
+ public function new(x:Float, y:Float)
+ {
+ super();
+
+ Conductor.songPosition = 0;
+
+ bf = new Boyfriend(x, y);
+ add(bf);
+
+ camFollow = new FlxObject(bf.getGraphicMidpoint().x, bf.getGraphicMidpoint().y, 1, 1);
+ add(camFollow);
+
+ FlxG.sound.play('assets/sounds/fnf_loss_sfx' + TitleState.soundExt);
+ Conductor.changeBPM(100);
+
+ // FlxG.camera.followLerp = 1;
+ // FlxG.camera.focusOn(FlxPoint.get(FlxG.width / 2, FlxG.height / 2));
+ FlxG.camera.scroll.set();
+ FlxG.camera.target = null;
+
+ bf.playAnim('firstDeath');
+ }
+
+ override function update(elapsed:Float)
+ {
+ super.update(elapsed);
+
+ if (FlxG.keys.justPressed.ENTER)
+ {
+ endBullshit();
+ }
+
+ if (bf.animation.curAnim.name == 'firstDeath' && bf.animation.curAnim.curFrame == 12)
+ {
+ FlxG.camera.follow(camFollow, LOCKON, 0.01);
+ }
+
+ if (bf.animation.curAnim.name == 'firstDeath' && bf.animation.curAnim.finished)
+ {
+ FlxG.sound.playMusic('assets/music/gameOver' + TitleState.soundExt);
+ }
+
+ if (FlxG.sound.music.playing)
+ {
+ Conductor.songPosition = FlxG.sound.music.time;
+ }
+ }
+
+ override function beatHit()
+ {
+ super.beatHit();
+
+ FlxG.log.add('beat');
+ }
+
+ var isEnding:Bool = false;
+
+ function endBullshit():Void
+ {
+ if (!isEnding)
+ {
+ isEnding = true;
+ bf.playAnim('deathConfirm', true);
+ FlxG.sound.music.stop();
+ FlxG.sound.play('assets/music/gameOverEnd' + TitleState.soundExt);
+ new FlxTimer().start(0.7, function(tmr:FlxTimer)
+ {
+ FlxG.camera.fade(FlxColor.BLACK, 2, false, function()
+ {
+ FlxG.switchState(new PlayState());
+ });
+ });
+ }
+ }
+}
diff --git a/source/Main.hx b/source/Main.hx
index e2e0f4dee..13376db44 100644
--- a/source/Main.hx
+++ b/source/Main.hx
@@ -9,7 +9,7 @@ class Main extends Sprite
public function new()
{
super();
- addChild(new FlxGame(0, 0, FreeplayState));
+ addChild(new FlxGame(0, 0, TitleState));
#if !mobile
addChild(new FPS(10, 3, 0xFFFFFF));
diff --git a/source/MenuItem.hx b/source/MenuItem.hx
new file mode 100644
index 000000000..5e7ddc763
--- /dev/null
+++ b/source/MenuItem.hx
@@ -0,0 +1,38 @@
+package;
+
+import flixel.FlxSprite;
+import flixel.graphics.frames.FlxAtlasFrames;
+import flixel.group.FlxSpriteGroup;
+import flixel.math.FlxMath;
+
+class MenuItem extends FlxSpriteGroup
+{
+ public var targetY:Float = 0;
+
+ public function new(x:Float, y:Float, weekNum:Int = 0, unlocked:Bool = false)
+ {
+ super(x, y);
+
+ var tex = FlxAtlasFrames.fromSparrow(AssetPaths.campaign_menu_UI_assets__png, AssetPaths.campaign_menu_UI_assets__xml);
+
+ var week:FlxSprite = new FlxSprite();
+ week.frames = tex;
+ week.animation.addByPrefix('week0', "WEEK1 select", 24);
+ week.animation.addByPrefix('week1', "week2 select", 24);
+ add(week);
+
+ week.animation.play('week' + weekNum);
+ week.updateHitbox();
+
+ if (!unlocked)
+ {
+ week.alpha = 0.6;
+ }
+ }
+
+ override function update(elapsed:Float)
+ {
+ super.update(elapsed);
+ y = FlxMath.lerp(y, (targetY * 120) + 480, 0.17);
+ }
+}
diff --git a/source/MusicBeatState.hx b/source/MusicBeatState.hx
index 321dc29c7..791cd95c7 100644
--- a/source/MusicBeatState.hx
+++ b/source/MusicBeatState.hx
@@ -15,6 +15,10 @@ class MusicBeatState extends FlxUIState
private var curStep:Int = 0;
private var curBeat:Int = 0;
+ private var controls(get, never):Controls;
+
+ inline function get_controls():Controls
+ return PlayerSettings.player1.controls;
override function create()
{
diff --git a/source/MusicBeatSubstate.hx b/source/MusicBeatSubstate.hx
new file mode 100644
index 000000000..0e452e9cd
--- /dev/null
+++ b/source/MusicBeatSubstate.hx
@@ -0,0 +1,78 @@
+package;
+
+import flixel.FlxSubState;
+
+class MusicBeatSubstate extends FlxSubState
+{
+ public function new()
+ {
+ super();
+ }
+
+ private var lastBeat:Float = 0;
+ private var lastStep:Float = 0;
+
+ private var totalBeats:Int = 0;
+ private var totalSteps:Int = 0;
+
+ private var curStep:Int = 0;
+ private var curBeat:Int = 0;
+ private var controls(get, never):Controls;
+
+ inline function get_controls():Controls
+ return PlayerSettings.player1.controls;
+
+ override function create()
+ {
+ #if (!web)
+ TitleState.soundExt = '.ogg';
+ #end
+
+ super.create();
+ }
+
+ override function update(elapsed:Float)
+ {
+ everyStep();
+
+ updateCurStep();
+ curBeat = Math.round(curStep / 4);
+
+ super.update(elapsed);
+ }
+
+ /**
+ * CHECKS EVERY FRAME
+ */
+ private function everyStep():Void
+ {
+ if (Conductor.songPosition > lastStep + Conductor.stepCrochet - Conductor.safeZoneOffset
+ || Conductor.songPosition < lastStep + Conductor.safeZoneOffset)
+ {
+ if (Conductor.songPosition > lastStep + Conductor.stepCrochet)
+ {
+ stepHit();
+ }
+ }
+ }
+
+ private function updateCurStep():Void
+ {
+ curStep = Math.floor(Conductor.songPosition / Conductor.stepCrochet);
+ }
+
+ public function stepHit():Void
+ {
+ totalSteps += 1;
+ lastStep += Conductor.stepCrochet;
+
+ if (totalSteps % 4 == 0)
+ beatHit();
+ }
+
+ public function beatHit():Void
+ {
+ lastBeat += Conductor.crochet;
+ totalBeats += 1;
+ }
+}
diff --git a/source/Note.hx b/source/Note.hx
index 521dc22b8..748cbe185 100644
--- a/source/Note.hx
+++ b/source/Note.hx
@@ -130,8 +130,9 @@ class Note extends FlxSprite
if (mustPress)
{
+ // The * 0.5 us so that its easier to hit them too late, instead of too early
if (strumTime > Conductor.songPosition - Conductor.safeZoneOffset
- && strumTime < Conductor.songPosition + Conductor.safeZoneOffset)
+ && strumTime < Conductor.songPosition + (Conductor.safeZoneOffset * 0.5))
{
canBeHit = true;
}
diff --git a/source/PauseSubState.hx b/source/PauseSubState.hx
index a4a1278dc..dbf232b6d 100644
--- a/source/PauseSubState.hx
+++ b/source/PauseSubState.hx
@@ -9,7 +9,7 @@ import flixel.util.FlxColor;
class PauseSubState extends FlxSubState
{
- public function new()
+ public function new(x:Float, y:Float)
{
super();
var bg:FlxSprite = new FlxSprite().makeGraphic(FlxG.width, FlxG.height, FlxColor.BLACK);
@@ -17,6 +17,12 @@ class PauseSubState extends FlxSubState
bg.scrollFactor.set();
add(bg);
+ var bf:Boyfriend = new Boyfriend(x, y);
+ bf.scrollFactor.set();
+ // add(bf);
+
+ bf.playAnim('firstDeath');
+
bg.cameras = [FlxG.cameras.list[1]];
}
diff --git a/source/PlayState.hx b/source/PlayState.hx
index ef165d435..9f4784dfb 100644
--- a/source/PlayState.hx
+++ b/source/PlayState.hx
@@ -48,9 +48,6 @@ class PlayState extends MusicBeatState
private var strumLine:FlxSprite;
private var curSection:Int = 0;
- private var sectionScores:Array = [[], []];
- private var sectionLengths:Array = [];
-
private var camFollow:FlxObject;
private var strumLineNotes:FlxTypedGroup;
private var playerStrums:FlxTypedGroup;
@@ -72,11 +69,6 @@ class PlayState extends MusicBeatState
private var camHUD:FlxCamera;
private var camGame:FlxCamera;
- var controls(get, never):Controls;
-
- inline function get_controls():Controls
- return PlayerSettings.player1.controls;
-
override public function create()
{
// var gameCam:FlxCamera = FlxG.camera;
@@ -89,14 +81,14 @@ class PlayState extends MusicBeatState
FlxCamera.defaultCameras = [camGame];
- PlayerSettings.init();
-
persistentUpdate = true;
persistentDraw = true;
if (SONG == null)
SONG = Song.loadFromJson(curLevel);
+ Conductor.changeBPM(SONG.bpm);
+
var bg:FlxSprite = new FlxSprite(-600, -200).loadGraphic(AssetPaths.stageback__png);
// bg.setGraphicSize(Std.int(bg.width * 2.5));
// bg.updateHitbox();
@@ -135,6 +127,8 @@ class PlayState extends MusicBeatState
gf.visible = false;
case "spooky":
dad.y += 200;
+ case "monster":
+ dad.y += 100;
}
boyfriend = new Boyfriend(770, 450);
@@ -194,6 +188,12 @@ class PlayState extends MusicBeatState
strumLineNotes.cameras = [camHUD];
notes.cameras = [camHUD];
+ healthBar.cameras = [camHUD];
+ healthBarBG.cameras = [camHUD];
+ healthHeads.cameras = [camHUD];
+
+ // if (SONG.song == 'South')
+ // FlxG.camera.alpha = 0.7;
// UI_camera.zoom = 1;
// cameras = [FlxG.cameras.list[1]];
@@ -213,6 +213,10 @@ class PlayState extends MusicBeatState
startTimer = new FlxTimer().start(Conductor.crochet / 1000, function(tmr:FlxTimer)
{
+ dad.dance();
+ gf.dance();
+ boyfriend.playAnim('idle');
+
switch (swagCounter)
{
case 0:
@@ -307,11 +311,6 @@ class PlayState extends MusicBeatState
// NEW SHIT
noteData = songData.notes;
- for (i in 1...songData.sections + 1)
- {
- // noteData.push(ChartParser.parse(songData.song.toLowerCase(), i));
- }
-
var playerCounter:Int = 0;
var daBeats:Int = 0; // Not exactly representative of 'daBeats' lol, just how much it has looped
@@ -321,15 +320,12 @@ class PlayState extends MusicBeatState
for (songNotes in section.sectionNotes)
{
- sectionScores[0].push(0);
- sectionScores[1].push(0);
-
var daStrumTime:Float = songNotes[0];
var daNoteData:Int = Std.int(songNotes[1] % 4);
var gottaHitNote:Bool = section.mustHitSection;
- if (songNotes.noteData > 3)
+ if (songNotes[1] > 3)
{
gottaHitNote = !section.mustHitSection;
}
@@ -374,26 +370,7 @@ class PlayState extends MusicBeatState
else
{
}
-
- // WILL HAVE TO REDO SCORE SYSTEM
- /* if (section.mustHitSection)
- {
- if (playerCounter == 1) // is the player
- {
- swagNote.mustPress = true;
- }
- else
- {
- //sectionScores[0][daBeats] += swagNote.noteScore;
- }
- }
- */
}
-
- /* // only need to do it once
- if (section.mustHitSection)
- sectionLengths.push(Math.round(coolSection / 4));
- */
daBeats += 1;
}
@@ -471,8 +448,6 @@ class PlayState extends MusicBeatState
}
}
- var sectionScored:Bool = false;
-
override function openSubState(SubState:FlxSubState)
{
if (paused)
@@ -526,7 +501,7 @@ class PlayState extends MusicBeatState
persistentDraw = true;
paused = true;
- openSubState(new PauseSubState());
+ openSubState(new PauseSubState(boyfriend.getScreenPosition().x, boyfriend.getScreenPosition().y));
}
if (FlxG.keys.justPressed.ESCAPE)
@@ -581,16 +556,6 @@ class PlayState extends MusicBeatState
// Conductor.lastSongPos = FlxG.sound.music.time;
}
- var playerTurn:Int = 0;
- if (sectionLengths.length > curSection)
- playerTurn = totalBeats % (sectionLengths[curSection] * 8);
-
- if (playerTurn == (sectionLengths[curSection] * 8) - 1 && !sectionScored)
- {
- // popUpScore();
- sectionScored = true;
- }
-
if (generatedMusic && PlayState.SONG.notes[Std.int(curStep / 16)] != null)
{
if (curBeat % 4 == 0)
@@ -625,11 +590,6 @@ class PlayState extends MusicBeatState
FlxG.camera.zoom = FlxMath.lerp(1.05, FlxG.camera.zoom, 0.96);
}
- if (playerTurn < 4)
- {
- sectionScored = false;
- }
-
FlxG.watch.addQuick("beatShit", totalBeats);
if (curSong == 'Fresh')
@@ -667,7 +627,17 @@ class PlayState extends MusicBeatState
if (health <= 0)
{
boyfriend.stunned = true;
- FlxG.switchState(new GameOverState());
+
+ 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));
}
if (unspawnNotes[0] != null)
@@ -702,15 +672,18 @@ class PlayState extends MusicBeatState
switch (Math.abs(daNote.noteData))
{
case 2:
- dad.playAnim('singUP');
+ dad.playAnim('singUP', true);
case 3:
- dad.playAnim('singRIGHT');
+ dad.playAnim('singRIGHT', true);
case 1:
- dad.playAnim('singDOWN');
+ dad.playAnim('singDOWN', true);
case 0:
- dad.playAnim('singLEFT');
+ dad.playAnim('singLEFT', true);
}
+ if (SONG.needsVoices)
+ vocals.volume = 1;
+
daNote.kill();
notes.remove(daNote, true);
daNote.destroy();
@@ -724,7 +697,7 @@ class PlayState extends MusicBeatState
{
if (daNote.tooLate)
{
- health -= 0.05;
+ health -= 0.03;
vocals.volume = 0;
}
@@ -744,12 +717,10 @@ class PlayState extends MusicBeatState
private function popUpScore(strumtime:Float):Void
{
var noteDiff:Float = Math.abs(strumtime - Conductor.songPosition);
-
// boyfriend.playAnim('hey');
- // vocals.volume = 1;
+ vocals.volume = 1;
var placement:String = Std.string(combo);
- // var placement:String = sectionScores[1][curSection] + '/' + sectionScores[0][curSection];
var coolText:FlxText = new FlxText(0, 0, 0, placement, 32);
coolText.screenCenter();
@@ -878,72 +849,6 @@ class PlayState extends MusicBeatState
var downR = controls.DOWN_R;
var leftR = controls.LEFT_R;
- /*
- 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;
- }
- }
- */
-
// FlxG.watch.addQuick('asdfa', upP);
if ((upP || rightP || downP || leftP) && !boyfriend.stunned && generatedMusic)
{
@@ -1067,14 +972,16 @@ class PlayState extends MusicBeatState
{
if (!boyfriend.stunned)
{
- health -= 0.08;
+ health -= 0.055;
if (combo > 5)
{
gf.playAnim('sad');
}
combo = 0;
- FlxG.sound.play('assets/sounds/missnote' + FlxG.random.int(1, 3) + TitleState.soundExt, FlxG.random.float(0.05, 0.2));
+ 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');
boyfriend.stunned = true;
@@ -1154,8 +1061,11 @@ class PlayState extends MusicBeatState
{
if (!note.wasGoodHit)
{
- popUpScore(note.strumTime);
- combo += 1;
+ if (!note.isSustainNote)
+ {
+ popUpScore(note.strumTime);
+ combo += 1;
+ }
if (note.noteData >= 0)
health += 0.03;
@@ -1182,7 +1092,6 @@ class PlayState extends MusicBeatState
}
});
- sectionScores[1][curSection] += note.noteScore;
note.wasGoodHit = true;
vocals.volume = 1;
@@ -1194,12 +1103,22 @@ class PlayState extends MusicBeatState
override function stepHit()
{
- if (vocals.time > Conductor.songPosition + Conductor.stepCrochet || vocals.time < Conductor.songPosition - Conductor.stepCrochet)
+ if (SONG.needsVoices)
{
- vocals.pause();
- vocals.time = Conductor.songPosition;
- vocals.play();
+ if (vocals.time > Conductor.songPosition + Conductor.stepCrochet
+ || vocals.time < Conductor.songPosition - Conductor.stepCrochet)
+ {
+ vocals.pause();
+ vocals.time = Conductor.songPosition;
+ vocals.play();
+ }
}
+
+ if (dad.curCharacter == 'spooky' && totalSteps % 4 == 2)
+ {
+ // dad.dance();
+ }
+
super.stepHit();
}
@@ -1212,16 +1131,40 @@ class PlayState extends MusicBeatState
notes.sort(FlxSort.byY, FlxSort.DESCENDING);
}
+ FlxG.log.add('change bpm' + SONG.notes[Std.int(curStep / 16)].changeBPM);
+ if (SONG.notes[Std.int(curStep / 16)].changeBPM)
+ {
+ Conductor.changeBPM(SONG.notes[Std.int(curStep / 16)].bpm);
+ FlxG.log.add('CHANGED BPM!');
+ }
+ else
+ Conductor.changeBPM(SONG.bpm);
+
if (camZooming && FlxG.camera.zoom < 1.35 && totalBeats % 4 == 0)
FlxG.camera.zoom += 0.025;
- dad.dance();
+ // Dad doesnt interupt his own notes
+ if (SONG.notes[Std.int(curStep / 16)].mustHitSection)
+ dad.dance();
+
healthHeads.setGraphicSize(Std.int(healthHeads.width + 20));
if (totalBeats % gfSpeed == 0)
+ {
gf.dance();
+ }
if (!boyfriend.animation.curAnim.name.startsWith("sing"))
boyfriend.playAnim('idle');
+
+ if (totalBeats % 8 == 6)
+ {
+ boyfriend.playAnim('hey', true);
+
+ if (SONG.song == 'Tutorial' && dad.curCharacter == 'gf')
+ {
+ dad.playAnim('cheer', true);
+ }
+ }
}
}
diff --git a/source/Section.hx b/source/Section.hx
index c811e306d..19770b6ea 100644
--- a/source/Section.hx
+++ b/source/Section.hx
@@ -6,6 +6,8 @@ typedef SwagSection =
var lengthInSteps:Int;
var typeOfSection:Int;
var mustHitSection:Bool;
+ var bpm:Int;
+ var changeBPM:Bool;
}
class Section
diff --git a/source/StoryMenuState.hx b/source/StoryMenuState.hx
new file mode 100644
index 000000000..bae5703c0
--- /dev/null
+++ b/source/StoryMenuState.hx
@@ -0,0 +1,172 @@
+package;
+
+import flixel.FlxG;
+import flixel.FlxSprite;
+import flixel.graphics.frames.FlxAtlasFrames;
+import flixel.group.FlxGroup.FlxTypedGroup;
+import flixel.group.FlxGroup;
+import flixel.text.FlxText;
+
+using StringTools;
+
+class StoryMenuState extends MusicBeatState
+{
+ var scoreText:FlxText;
+
+ var weekData:Array = [['Tutorial', 'Bopeebo', 'Fresh', 'Dad Battle'], ['Spookeez', 'South', 'Monster']];
+ var weekUnlocked:Array = [true, false];
+
+ var curWeek:Int = 0;
+
+ var txtTracklist:FlxText;
+
+ var grpWeekText:FlxTypedGroup