mirror of
https://github.com/ninjamuffin99/Funkin.git
synced 2024-08-19 23:15:15 +00:00
almost making progress on note shit
This commit is contained in:
parent
7b4826de33
commit
cfe3c10964
|
@ -28,7 +28,6 @@ using StringTools;
|
|||
class ChartingState extends MusicBeatState
|
||||
{
|
||||
var _file:FileReference;
|
||||
var notes:Array<Dynamic> = [];
|
||||
|
||||
var UI_box:FlxUI9SliceSprite;
|
||||
|
||||
|
@ -168,6 +167,12 @@ class ChartingState extends MusicBeatState
|
|||
}
|
||||
}
|
||||
|
||||
if (FlxG.keys.justPressed.ENTER)
|
||||
{
|
||||
PlayState.SONG = new Song(curSong, getNotes(), Conductor.bpm, sections.length);
|
||||
FlxG.switchState(new PlayState());
|
||||
}
|
||||
|
||||
if (FlxG.keys.justPressed.SPACE)
|
||||
{
|
||||
if (FlxG.sound.music.playing)
|
||||
|
@ -269,17 +274,17 @@ class ChartingState extends MusicBeatState
|
|||
|
||||
function getStrumTime(yPos:Float):Float
|
||||
{
|
||||
return FlxMath.remapToRange(yPos, gridBG.y, gridBG.y + gridBG.height, 0, 16 * Conductor.stepCrochet);
|
||||
return FlxMath.remapToRange(yPos, gridBG.y, gridBG.y + gridBG.height, 0, (16 * Conductor.stepCrochet) * FlxMath.maxInt(curSection, 1));
|
||||
}
|
||||
|
||||
function getYfromStrum(strumTime:Float):Float
|
||||
{
|
||||
return FlxMath.remapToRange(strumTime, 0, Conductor.stepCrochet * 16, gridBG.y, gridBG.y + gridBG.height);
|
||||
return FlxMath.remapToRange(strumTime, 0, (16 * Conductor.stepCrochet) * FlxMath.maxInt(curSection, 1), gridBG.y, gridBG.y + gridBG.height);
|
||||
}
|
||||
|
||||
private var daSpacing:Float = 0.3;
|
||||
|
||||
private function saveLevel()
|
||||
function getNotes():Array<Dynamic>
|
||||
{
|
||||
var noteData:Array<Dynamic> = [];
|
||||
|
||||
|
@ -288,11 +293,16 @@ class ChartingState extends MusicBeatState
|
|||
noteData.push(i.notes);
|
||||
}
|
||||
|
||||
return noteData;
|
||||
}
|
||||
|
||||
private function saveLevel()
|
||||
{
|
||||
var json = {
|
||||
"song": curSong,
|
||||
"bpm": Conductor.bpm,
|
||||
"sections": sections.length,
|
||||
'notes': noteData
|
||||
'notes': getNotes
|
||||
};
|
||||
|
||||
var data:String = Json.stringify(json);
|
||||
|
@ -303,7 +313,7 @@ class ChartingState extends MusicBeatState
|
|||
_file.addEventListener(Event.COMPLETE, onSaveComplete);
|
||||
_file.addEventListener(Event.CANCEL, onSaveCancel);
|
||||
_file.addEventListener(IOErrorEvent.IO_ERROR, onSaveError);
|
||||
// _file.save(data.trim(), json.song + ".json");
|
||||
_file.save(data.trim(), json.song.toLowerCase() + ".json");
|
||||
_file.browse();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -29,7 +29,7 @@ using StringTools;
|
|||
class PlayState extends MusicBeatState
|
||||
{
|
||||
public static var curLevel:String = 'Bopeebo';
|
||||
public static var SONG:Song = Song.loadFromJson('bopeebo');
|
||||
public static var SONG:Song;
|
||||
|
||||
private var vocals:FlxSound;
|
||||
|
||||
|
@ -70,6 +70,9 @@ class PlayState extends MusicBeatState
|
|||
persistentUpdate = true;
|
||||
persistentDraw = true;
|
||||
|
||||
if (SONG == null)
|
||||
SONG = Song.loadFromJson('tutorial');
|
||||
|
||||
var bg:FlxSprite = new FlxSprite(-600, -200).loadGraphic(AssetPaths.stageback__png);
|
||||
// bg.setGraphicSize(Std.int(bg.width * 2.5));
|
||||
// bg.updateHitbox();
|
||||
|
@ -116,7 +119,7 @@ class PlayState extends MusicBeatState
|
|||
|
||||
var swagCounter:Int = 0;
|
||||
|
||||
generateSong(curLevel.toLowerCase());
|
||||
generateSong(SONG.song);
|
||||
countingDown = true;
|
||||
Conductor.songPosition = 0;
|
||||
Conductor.songPosition -= Conductor.crochet * 5;
|
||||
|
@ -215,7 +218,7 @@ class PlayState extends MusicBeatState
|
|||
function startSong():Void
|
||||
{
|
||||
countingDown = false;
|
||||
FlxG.sound.playMusic("assets/music/" + curLevel + "_Inst" + TitleState.soundExt);
|
||||
FlxG.sound.playMusic("assets/music/" + SONG.song + "_Inst" + TitleState.soundExt);
|
||||
vocals.play();
|
||||
}
|
||||
|
||||
|
@ -229,7 +232,7 @@ class PlayState extends MusicBeatState
|
|||
generateStaticArrows(0);
|
||||
generateStaticArrows(1);
|
||||
|
||||
var songData = Json.parse(Assets.getText('assets/data/' + dataPath + '/' + dataPath + '.json'));
|
||||
var songData = SONG;
|
||||
Conductor.changeBPM(songData.bpm);
|
||||
|
||||
curSong = songData.song;
|
||||
|
@ -242,9 +245,12 @@ class PlayState extends MusicBeatState
|
|||
|
||||
var noteData:Array<Dynamic> = [];
|
||||
|
||||
// NEW SHIT
|
||||
noteData = songData.notes;
|
||||
|
||||
for (i in 1...songData.sections + 1)
|
||||
{
|
||||
noteData.push(ChartParser.parse(songData.song.toLowerCase(), i));
|
||||
// noteData.push(ChartParser.parse(songData.song.toLowerCase(), i));
|
||||
}
|
||||
|
||||
var playerCounter:Int = 0;
|
||||
|
@ -256,8 +262,6 @@ class PlayState extends MusicBeatState
|
|||
for (section in noteData)
|
||||
{
|
||||
var dumbassSection:Array<Dynamic> = section;
|
||||
|
||||
var daStep:Int = 0;
|
||||
var coolSection:Int = Std.int(section.length / 4);
|
||||
|
||||
if (coolSection <= 4) // FIX SINCE MOST THE SHIT I MADE WERE ONLY 3 HTINGS LONG LOl
|
||||
|
@ -270,10 +274,12 @@ class PlayState extends MusicBeatState
|
|||
sectionScores[0].push(0);
|
||||
sectionScores[1].push(0);
|
||||
|
||||
if (songNotes != 0)
|
||||
var daStrumTime:Float = songNotes[0];
|
||||
var daNoteData:Int = songNotes[1];
|
||||
|
||||
if (daNoteData != 0)
|
||||
{
|
||||
var daStrumTime:Float = ((daStep * Conductor.stepCrochet) + (Conductor.crochet * 8 * totalLength))
|
||||
+ ((Conductor.crochet * coolSection) * playerCounter);
|
||||
var daStrumTime:Float = daStrumTime;
|
||||
|
||||
var oldNote:Note;
|
||||
if (unspawnNotes.length > 0)
|
||||
|
@ -281,7 +287,7 @@ class PlayState extends MusicBeatState
|
|||
else
|
||||
oldNote = null;
|
||||
|
||||
var swagNote:Note = new Note(daStrumTime, songNotes, oldNote);
|
||||
var swagNote:Note = new Note(daStrumTime, daNoteData, oldNote);
|
||||
swagNote.scrollFactor.set(0, 0);
|
||||
|
||||
unspawnNotes.push(swagNote);
|
||||
|
@ -297,8 +303,6 @@ class PlayState extends MusicBeatState
|
|||
sectionScores[0][daBeats] += swagNote.noteScore;
|
||||
}
|
||||
}
|
||||
|
||||
daStep += 1;
|
||||
}
|
||||
|
||||
// only need to do it once
|
||||
|
|
Loading…
Reference in a new issue