1
0
Fork 0
mirror of https://github.com/ninjamuffin99/Funkin.git synced 2024-12-23 21:56:46 +00:00

re added sustain notes lol

This commit is contained in:
Cameron Taylor 2020-10-19 18:59:00 -07:00
parent d158afdaf7
commit 87d0b36070
3 changed files with 53 additions and 30 deletions

View file

@ -370,6 +370,17 @@ class ChartingState extends MusicBeatState
}
});
}
else
{
if (FlxG.mouse.x > gridBG.x
&& FlxG.mouse.x < gridBG.x + gridBG.width
&& FlxG.mouse.y > gridBG.y
&& FlxG.mouse.y < gridBG.y + (GRID_SIZE * _song.notes[curSection].lengthInSteps))
{
FlxG.log.add('added note');
addNote();
}
}
}
if (FlxG.mouse.x > gridBG.x
@ -382,15 +393,6 @@ class ChartingState extends MusicBeatState
dummyArrow.y = FlxG.mouse.y;
else
dummyArrow.y = Math.floor(FlxG.mouse.y / GRID_SIZE) * GRID_SIZE;
if (FlxG.mouse.justPressed)
{
if (!FlxG.mouse.overlaps(curRenderedNotes))
{
FlxG.log.add('added note');
addNote();
}
}
}
if (FlxG.keys.justPressed.ENTER)
@ -587,7 +589,7 @@ class ChartingState extends MusicBeatState
{
for (i in _song.notes[curSection].sectionNotes)
{
if (i.strumTime == note.strumTime && i.noteData % 4 == note.noteData)
if (i[0] == note.strumTime && i[1] % 4 == note.noteData)
{
FlxG.log.add('FOUND EVIL NUMBER');
_song.notes[curSection].sectionNotes.remove(i);

View file

@ -16,6 +16,7 @@ class Note extends FlxSprite
public var prevNote:Note;
public var sustainLength:Float = 0;
public var isSustainNote:Bool = false;
public var noteScore:Float = 1;
@ -25,7 +26,7 @@ class Note extends FlxSprite
public static var BLUE_NOTE:Int = 1;
public static var RED_NOTE:Int = 3;
public function new(strumTime:Float, noteData:Int, ?prevNote:Note)
public function new(strumTime:Float, noteData:Int, ?prevNote:Note, ?sustainNote:Bool = false)
{
super();
@ -33,6 +34,7 @@ class Note extends FlxSprite
prevNote = this;
this.prevNote = prevNote;
isSustainNote = sustainNote;
x += 50;
this.strumTime = strumTime;
@ -78,7 +80,7 @@ class Note extends FlxSprite
trace(prevNote);
if (noteData < 0 && prevNote != null)
if (isSustainNote && prevNote != null)
{
noteScore * 0.2;
alpha = 0.6;
@ -87,13 +89,13 @@ class Note extends FlxSprite
switch (noteData)
{
case -1:
case 2:
animation.play('greenholdend');
case -2:
case 3:
animation.play('redholdend');
case -3:
case 1:
animation.play('blueholdend');
case -4:
case 0:
animation.play('purpleholdend');
}
@ -101,22 +103,22 @@ class Note extends FlxSprite
x -= width / 2;
if (prevNote.noteData < 0)
if (prevNote.isSustainNote)
{
switch (prevNote.noteData)
{
case -1:
case 2:
prevNote.animation.play('greenhold');
case -2:
case 3:
prevNote.animation.play('redhold');
case -3:
case 1:
prevNote.animation.play('bluehold');
case -4:
case 0:
prevNote.animation.play('purplehold');
}
prevNote.offset.y = -19;
prevNote.scale.y *= 2.25;
prevNote.scale.y *= (2.25 * PlayState.SONG.speed);
// prevNote.setGraphicSize();
}
}

View file

@ -274,8 +274,8 @@ class PlayState extends MusicBeatState
sectionScores[0].push(0);
sectionScores[1].push(0);
var daStrumTime:Float = songNotes.strumTime;
var daNoteData:Int = Std.int(songNotes.noteData % 4);
var daStrumTime:Float = songNotes[0];
var daNoteData:Int = Std.int(songNotes[1] % 4);
var gottaHitNote:Bool = section.mustHitSection;
@ -291,11 +291,30 @@ class PlayState extends MusicBeatState
oldNote = null;
var swagNote:Note = new Note(daStrumTime, daNoteData, oldNote);
swagNote.sustainLength = songNotes.sustainLength;
swagNote.sustainLength = songNotes[2];
swagNote.scrollFactor.set(0, 0);
var susLength:Float = swagNote.sustainLength;
susLength = susLength / Conductor.stepCrochet;
unspawnNotes.push(swagNote);
for (susNote in 0...Math.floor(susLength))
{
oldNote = unspawnNotes[Std.int(unspawnNotes.length - 1)];
var sustainNote:Note = new Note(daStrumTime + (Conductor.stepCrochet * susNote), daNoteData, oldNote, true);
sustainNote.scrollFactor.set();
unspawnNotes.push(sustainNote);
sustainNote.mustPress = gottaHitNote;
if (sustainNote.mustPress)
{
sustainNote.x += FlxG.width / 2; // general offset
}
}
swagNote.mustPress = gottaHitNote;
if (swagNote.mustPress)
@ -891,21 +910,21 @@ class PlayState extends MusicBeatState
{
notes.forEach(function(daNote:Note)
{
if (daNote.canBeHit && daNote.mustPress)
if (daNote.canBeHit && daNote.mustPress && daNote.isSustainNote)
{
switch (daNote.noteData)
{
// NOTES YOU ARE HOLDING
case -1:
case 2:
if (up && daNote.prevNote.wasGoodHit)
goodNoteHit(daNote);
case -2:
case 3:
if (right && daNote.prevNote.wasGoodHit)
goodNoteHit(daNote);
case -3:
case 1:
if (down && daNote.prevNote.wasGoodHit)
goodNoteHit(daNote);
case -4:
case 0:
if (left && daNote.prevNote.wasGoodHit)
goodNoteHit(daNote);
}