so close to proper note reading...

This commit is contained in:
Cameron Taylor 2020-10-13 02:55:00 -07:00
parent 2673a04d27
commit dc11504c25
1 changed files with 9 additions and 11 deletions

View File

@ -138,7 +138,7 @@ class ChartingState extends MusicBeatState
{
Conductor.songPosition = FlxG.sound.music.time;
strumLine.y = getYfromStrum(Conductor.songPosition % (Conductor.stepCrochet * 16), false);
strumLine.y = getYfromStrum(Conductor.songPosition % (Conductor.stepCrochet * 16));
if (curBeat % 4 == 0)
{
@ -243,7 +243,7 @@ class ChartingState extends MusicBeatState
note.setGraphicSize(GRID_SIZE, GRID_SIZE);
note.updateHitbox();
note.x = Math.floor(i[1] * GRID_SIZE);
note.y = getYfromStrum(note.strumTime) % (Conductor.stepCrochet * sections[curSection].lengthInSteps);
note.y = getYfromStrum(note.strumTime) % gridBG.height;
curRenderedNotes.add(note);
}
@ -257,9 +257,13 @@ class ChartingState extends MusicBeatState
private function addNote():Void
{
sections[curSection].notes.push([
getStrumTime(dummyArrow.y) * FlxMath.maxInt(curSection, 1),
getStrumTime(dummyArrow.y) + (curSection * (Conductor.stepCrochet * 16)),
Math.floor(FlxG.mouse.x / GRID_SIZE)
]);
trace(getStrumTime(dummyArrow.y) + (curSection * (Conductor.stepCrochet * 16)));
trace(curSection);
updateGrid();
}
@ -268,15 +272,9 @@ class ChartingState extends MusicBeatState
return FlxMath.remapToRange(yPos, gridBG.y, gridBG.y + gridBG.height, 0, 16 * Conductor.stepCrochet);
}
function getYfromStrum(strumTime:Float, ?isNote:Bool = true):Float
function getYfromStrum(strumTime:Float):Float
{
var strumShit:Float = 0;
if (isNote)
strumShit = FlxMath.remapToRange(strumTime, 0, (16 * Conductor.stepCrochet) * FlxMath.maxInt(curSection, 1), gridBG.y, gridBG.y + gridBG.height);
else
strumShit = FlxMath.remapToRange(strumTime, 0, 16 * Conductor.stepCrochet, gridBG.y, gridBG.y + gridBG.height);
return strumShit;
return FlxMath.remapToRange(strumTime, 0, 16 * Conductor.stepCrochet, gridBG.y, gridBG.y + gridBG.height);
}
private var daSpacing:Float = 0.3;