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