From 06ef3c852998a5d210cde4e23b2217ce5f8d1f9b Mon Sep 17 00:00:00 2001 From: Cameron Taylor Date: Sun, 18 Oct 2020 19:51:01 -0700 Subject: [PATCH] almost got sustains working --- source/ChartingState.hx | 25 ++++++++++++++++++------- 1 file changed, 18 insertions(+), 7 deletions(-) diff --git a/source/ChartingState.hx b/source/ChartingState.hx index 40df2ba05..f01ea255f 100644 --- a/source/ChartingState.hx +++ b/source/ChartingState.hx @@ -62,7 +62,10 @@ class ChartingState extends MusicBeatState var _song:Song; var typingShit:FlxInputText; - var curSelectedNote:Note = new Note(0, 0, null); + /* + * WILL BE THE CURRENT / LAST PLACED NOTE + **/ + var curSelectedNote:Array; override function create() { @@ -330,6 +333,7 @@ class ChartingState extends MusicBeatState { if (FlxG.mouse.overlaps(note)) { + trace('tryin to delete note...'); deleteNote(note); } }); @@ -501,9 +505,6 @@ class ChartingState extends MusicBeatState 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); @@ -512,6 +513,13 @@ class ChartingState extends MusicBeatState note.y = getYfromStrum(daStrumTime) % gridBG.height; curRenderedNotes.add(note); + + if (daSus > 0) + { + var sustainVis:FlxSprite = new FlxSprite(note.x, + note.y).makeGraphic(8, Math.floor(FlxMath.remapToRange(daSus, 0, Conductor.stepCrochet * 16, 0, gridBG.height))); + curRenderedSustains.add(sustainVis); + } } } @@ -536,10 +544,13 @@ class ChartingState extends MusicBeatState private function addNote():Void { - var swagNote:NoteMeta = new NoteMeta(Math.round(getStrumTime(dummyArrow.y) + (curSection * (Conductor.stepCrochet * 16))), - Math.floor(FlxG.mouse.x / GRID_SIZE), 0); + var noteStrum = Math.round(getStrumTime(dummyArrow.y) + (curSection * (Conductor.stepCrochet * 16))); + var noteData = Math.floor(FlxG.mouse.x / GRID_SIZE); + var noteSus = 0; - _song.notes[curSection].sectionNotes.push(swagNote); + _song.notes[curSection].sectionNotes.push([noteStrum, noteData, noteSus]); + + curSelectedNote = _song.notes[curSection].sectionNotes[_song.notes[curSection].sectionNotes.length - 1]; trace(getStrumTime(dummyArrow.y) + (curSection * (Conductor.stepCrochet * 16))); trace(curSection);