1
0
Fork 0
mirror of https://github.com/ninjamuffin99/Funkin.git synced 2025-12-01 08:37:17 +00:00

MISS NOTES

This commit is contained in:
Cameron Taylor 2020-10-04 20:29:35 -07:00
parent 8845651c7d
commit b4bfdb1a69
3 changed files with 102 additions and 27 deletions

View file

@ -4,8 +4,12 @@ import flixel.FlxG;
import flixel.FlxSprite; import flixel.FlxSprite;
import flixel.graphics.frames.FlxAtlasFrames; import flixel.graphics.frames.FlxAtlasFrames;
using StringTools;
class Boyfriend extends Character class Boyfriend extends Character
{ {
public var stunned:Bool = false;
public function new(x:Float, y:Float) public function new(x:Float, y:Float)
{ {
super(x, y); super(x, y);
@ -13,10 +17,14 @@ class Boyfriend extends Character
var tex = FlxAtlasFrames.fromSparrow(AssetPaths.BOYFRIEND__png, AssetPaths.BOYFRIEND__xml); var tex = FlxAtlasFrames.fromSparrow(AssetPaths.BOYFRIEND__png, AssetPaths.BOYFRIEND__xml);
frames = tex; frames = tex;
animation.addByPrefix('idle', 'BF idle dance', 24, false); animation.addByPrefix('idle', 'BF idle dance', 24, false);
animation.addByPrefix('singUP', 'BF NOTE UP', 24, false); animation.addByPrefix('singUP', 'BF NOTE UP0', 24, false);
animation.addByPrefix('singLEFT', 'BF NOTE LEFT', 24, false); animation.addByPrefix('singLEFT', 'BF NOTE LEFT0', 24, false);
animation.addByPrefix('singRIGHT', 'BF NOTE RIGHT', 24, false); animation.addByPrefix('singRIGHT', 'BF NOTE RIGHT0', 24, false);
animation.addByPrefix('singDOWN', 'BF NOTE DOWN', 24, false); animation.addByPrefix('singDOWN', 'BF NOTE DOWN0', 24, false);
animation.addByPrefix('singUPmiss', 'BF NOTE UP MISS', 24, false);
animation.addByPrefix('singLEFTmiss', 'BF NOTE LEFT MISS', 24, false);
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('hey', 'BF HEY', 24, false);
playAnim('idle'); playAnim('idle');
@ -27,6 +35,19 @@ class Boyfriend extends Character
addOffset("singRIGHT", -38, -7); addOffset("singRIGHT", -38, -7);
addOffset("singLEFT", 12, -6); addOffset("singLEFT", 12, -6);
addOffset("singDOWN", -10, -50); addOffset("singDOWN", -10, -50);
addOffset("singUPmiss", -29, 27);
addOffset("singRIGHTmiss", -30, 21);
addOffset("singLEFTmiss", 12, 24);
addOffset("singDOWNmiss", -11, -19);
addOffset("hey", 7, 4); addOffset("hey", 7, 4);
} }
override function update(elapsed:Float)
{
if (animation.curAnim.name.endsWith('miss') && animation.curAnim.finished && !debugMode)
{
playAnim('idle', true, false, 10);
}
super.update(elapsed);
}
} }

View file

@ -75,9 +75,6 @@ class ChartParser
row++; row++;
} }
trace(dopeArray.length);
trace(dopeArray);
return dopeArray; return dopeArray;
} }
} }

View file

@ -139,10 +139,6 @@ class PlayState extends FlxState
sectionScores[0].push(0); sectionScores[0].push(0);
sectionScores[1].push(0); sectionScores[1].push(0);
trace('SECTON');
trace(daBeats);
trace(totalLength);
if (songNotes != 0) if (songNotes != 0)
{ {
var daStrumTime:Float = ((daStep * Conductor.stepCrochet) + (Conductor.crochet * 8 * totalLength)) var daStrumTime:Float = ((daStep * Conductor.stepCrochet) + (Conductor.crochet * 8 * totalLength))
@ -182,7 +178,6 @@ class PlayState extends FlxState
playerCounter += 1; playerCounter += 1;
} }
trace(sectionLengths);
} }
private function generateStaticArrows(player:Int):Void private function generateStaticArrows(player:Int):Void
@ -367,11 +362,21 @@ class PlayState extends FlxState
var downR = FlxG.keys.anyJustReleased([S, DOWN]); var downR = FlxG.keys.anyJustReleased([S, DOWN]);
var leftR = FlxG.keys.anyJustReleased([A, LEFT]); var leftR = FlxG.keys.anyJustReleased([A, LEFT]);
if (up || right || down || left) if ((up || right || down || left) && !boyfriend.stunned)
{ {
var possibleNotes:Array<Note> = [];
notes.forEach(function(daNote:Note) notes.forEach(function(daNote:Note)
{ {
if (daNote.canBeHit) if (daNote.canBeHit && daNote.mustPress)
{
possibleNotes.push(daNote);
}
});
if (possibleNotes.length > 0)
{
for (daNote in possibleNotes)
{ {
switch (daNote.noteData) switch (daNote.noteData)
{ {
@ -389,17 +394,13 @@ class PlayState extends FlxState
if (left && daNote.prevNote.wasGoodHit) if (left && daNote.prevNote.wasGoodHit)
goodNoteHit(daNote); goodNoteHit(daNote);
case 1: // NOTES YOU JUST PRESSED case 1: // NOTES YOU JUST PRESSED
if (upP) noteCheck(upP, daNote);
goodNoteHit(daNote);
case 2: case 2:
if (rightP) noteCheck(rightP, daNote);
goodNoteHit(daNote);
case 3: case 3:
if (downP) noteCheck(downP, daNote);
goodNoteHit(daNote);
case 4: case 4:
if (leftP) noteCheck(leftP, daNote);
goodNoteHit(daNote);
} }
if (daNote.wasGoodHit) if (daNote.wasGoodHit)
@ -407,7 +408,11 @@ class PlayState extends FlxState
daNote.kill(); daNote.kill();
} }
} }
}); }
else
{
badNoteCheck();
}
} }
playerStrums.forEach(function(spr:FlxSprite) playerStrums.forEach(function(spr:FlxSprite)
@ -415,22 +420,22 @@ class PlayState extends FlxState
switch (spr.ID) switch (spr.ID)
{ {
case 1: case 1:
if (upP && spr.animation.curAnim.name != 'confirm') if (upP && spr.animation.curAnim.name != 'confirm' && !boyfriend.stunned)
spr.animation.play('pressed'); spr.animation.play('pressed');
if (upR) if (upR)
spr.animation.play('static'); spr.animation.play('static');
case 2: case 2:
if (rightP && spr.animation.curAnim.name != 'confirm') if (rightP && spr.animation.curAnim.name != 'confirm' && !boyfriend.stunned)
spr.animation.play('pressed'); spr.animation.play('pressed');
if (rightR) if (rightR)
spr.animation.play('static'); spr.animation.play('static');
case 3: case 3:
if (downP && spr.animation.curAnim.name != 'confirm') if (downP && spr.animation.curAnim.name != 'confirm' && !boyfriend.stunned)
spr.animation.play('pressed'); spr.animation.play('pressed');
if (downR) if (downR)
spr.animation.play('static'); spr.animation.play('static');
case 4: case 4:
if (leftP && spr.animation.curAnim.name != 'confirm') if (leftP && spr.animation.curAnim.name != 'confirm' && !boyfriend.stunned)
spr.animation.play('pressed'); spr.animation.play('pressed');
if (leftR) if (leftR)
spr.animation.play('static'); spr.animation.play('static');
@ -446,6 +451,58 @@ class PlayState extends FlxState
}); });
} }
function noteMiss(direction:Int = 1):Void
{
if (!boyfriend.stunned)
{
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
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]);
if (leftP)
noteMiss(4);
if (upP)
noteMiss(1);
if (rightP)
noteMiss(2);
if (downP)
noteMiss(3);
}
function noteCheck(keyP:Bool, note:Note):Void
{
if (keyP)
goodNoteHit(note);
else
badNoteCheck();
}
function goodNoteHit(note:Note):Void function goodNoteHit(note:Note):Void
{ {
if (!note.wasGoodHit) if (!note.wasGoodHit)