1
0
Fork 0
mirror of https://github.com/ninjamuffin99/Funkin.git synced 2024-12-26 15:07:14 +00:00

ported sustain data into game

This commit is contained in:
Cameron Taylor 2020-10-18 19:34:21 -07:00
parent e443b1916d
commit 29496d7ab9
2 changed files with 41 additions and 12 deletions

File diff suppressed because one or more lines are too long

View file

@ -55,6 +55,7 @@ class ChartingState extends MusicBeatState
var dummyArrow:FlxSprite;
var curRenderedNotes:FlxTypedGroup<Note>;
var curRenderedSustains:FlxTypedGroup<FlxSprite>;
var gridBG:FlxSprite;
@ -69,6 +70,7 @@ class ChartingState extends MusicBeatState
add(gridBG);
curRenderedNotes = new FlxTypedGroup<Note>();
curRenderedSustains = new FlxTypedGroup<FlxSprite>();
if (PlayState.SONG != null)
_song = PlayState.SONG;
@ -113,6 +115,7 @@ class ChartingState extends MusicBeatState
addSectionUI();
add(curRenderedNotes);
add(curRenderedSustains);
super.create();
}
@ -319,6 +322,20 @@ class ChartingState extends MusicBeatState
}
}
if (FlxG.mouse.justPressed)
{
if (FlxG.mouse.overlaps(curRenderedNotes))
{
curRenderedNotes.forEach(function(note:Note)
{
if (FlxG.mouse.overlaps(note))
{
deleteNote(note);
}
});
}
}
if (FlxG.mouse.x > gridBG.x
&& FlxG.mouse.x < gridBG.x + gridBG.width
&& FlxG.mouse.y > gridBG.y
@ -332,17 +349,7 @@ class ChartingState extends MusicBeatState
if (FlxG.mouse.justPressed)
{
if (FlxG.mouse.overlaps(curRenderedNotes))
{
curRenderedNotes.forEach(function(note:Note)
{
if (FlxG.mouse.overlaps(note))
{
deleteNote(note);
}
});
}
else
if (!FlxG.mouse.overlaps(curRenderedNotes))
{
FlxG.log.add('added note');
addNote();
@ -467,14 +474,36 @@ class ChartingState extends MusicBeatState
curRenderedNotes.remove(curRenderedNotes.members[0], true);
}
while (curRenderedSustains.members.length > 0)
{
curRenderedSustains.remove(curRenderedSustains.members[0], true);
}
var sectionInfo:Array<Dynamic> = _song.notes[curSection].sectionNotes;
/* // PORT BULLSHIT, INCASE THERE'S NO SUSTAIN DATA FOR A NOTE
for (sec in 0..._song.notes.length)
{
for (notesse in 0..._song.notes[sec].sectionNotes.length)
{
if (_song.notes[sec].sectionNotes[notesse][2] == null)
{
trace('SUS NULL');
_song.notes[sec].sectionNotes[notesse][2] = 0;
}
}
}
*/
for (i in sectionInfo)
{
var daNoteInfo = i[1];
var daStrumTime = i[0];
var daSus = i[2];
if (daSus == null)
i[2] == 0;
var note:Note = new Note(daStrumTime, daNoteInfo % 4);
note.sustainLength = daSus;
note.setGraphicSize(GRID_SIZE, GRID_SIZE);