1
0
Fork 0
mirror of https://github.com/ninjamuffin99/Funkin.git synced 2024-11-25 08:13:45 +00:00

click and drag sustain

This commit is contained in:
Cameron Taylor 2022-02-06 13:56:18 -05:00
parent 36b5466057
commit 44e720ee28

View file

@ -776,8 +776,24 @@ class ChartingState extends MusicBeatState
}
}
if (FlxG.mouse.justReleased)
justPlacedNote = false;
if (FlxG.mouse.overlaps(gridBG))
{
if (justPlacedNote && FlxG.mouse.pressed && FlxG.mouse.y > getYfromStrum(curSelectedNote.strumTime))
{
var minusStuff:Float = FlxG.mouse.y - getYfromStrum(curSelectedNote.strumTime);
minusStuff -= GRID_SIZE;
minusStuff = Math.floor(minusStuff / GRID_SIZE) * GRID_SIZE;
minusStuff = FlxMath.remapToRange(minusStuff, 0, 40, 0, Conductor.stepCrochet);
curSelectedNote.sustainLength = minusStuff;
updateNoteUI();
updateGrid();
}
dummyArrow.x = Math.floor(FlxG.mouse.x / GRID_SIZE) * GRID_SIZE;
if (FlxG.keys.pressed.SHIFT)
dummyArrow.y = FlxG.mouse.y;
@ -1319,6 +1335,11 @@ class ChartingState extends MusicBeatState
updateGrid();
}
/**
* Is true if clicked and placed a note, set reset to false when releasing mouse button!
*/
var justPlacedNote:Bool = false;
private function addNote():Void
{
var noteStrum = getStrumTime(dummyArrow.y) + sectionStartTime();
@ -1326,6 +1347,8 @@ class ChartingState extends MusicBeatState
var noteSus = 0;
var noteAlt = false;
justPlacedNote = true;
// FlxG.sound.play(Paths.sound('pianoStuff/piano-00' + FlxG.random.int(1, 9)), FlxG.random.float(0.01, 0.3));
function makeAndPlayChord(soundsToPlay:Array<String>)
@ -1449,7 +1472,7 @@ class ChartingState extends MusicBeatState
function autosaveSong():Void
{
FlxG.save.data.autosave = _song;
trace(FlxG.save.data.autosave);
// trace(FlxG.save.data.autosave);
FlxG.save.flush();
}