mirror of
https://github.com/ninjamuffin99/Funkin.git
synced 2024-11-30 18:53:35 +00:00
almost got good prototyping shit in
This commit is contained in:
parent
c5d07c745f
commit
dd623ed22f
|
@ -57,6 +57,8 @@ class ChartingState extends MusicBeatState
|
||||||
var sections:Array<Section> = [];
|
var sections:Array<Section> = [];
|
||||||
var gridBG:FlxSprite;
|
var gridBG:FlxSprite;
|
||||||
|
|
||||||
|
var oldSongData:Song;
|
||||||
|
|
||||||
override function create()
|
override function create()
|
||||||
{
|
{
|
||||||
gridBG = FlxGridOverlay.create(GRID_SIZE, GRID_SIZE, GRID_SIZE * 8, GRID_SIZE * 16);
|
gridBG = FlxGridOverlay.create(GRID_SIZE, GRID_SIZE, GRID_SIZE * 8, GRID_SIZE * 16);
|
||||||
|
@ -66,6 +68,18 @@ class ChartingState extends MusicBeatState
|
||||||
|
|
||||||
addSection();
|
addSection();
|
||||||
|
|
||||||
|
if (PlayState.SONG != null)
|
||||||
|
oldSongData = PlayState.SONG;
|
||||||
|
else
|
||||||
|
{
|
||||||
|
oldSongData = new Song(curSong, sections, Conductor.bpm, sections.length);
|
||||||
|
}
|
||||||
|
|
||||||
|
curSong = oldSongData.song;
|
||||||
|
sections = oldSongData.notes;
|
||||||
|
|
||||||
|
updateGrid();
|
||||||
|
|
||||||
FlxG.sound.playMusic('assets/music/' + curSong + '.mp3', 0.6);
|
FlxG.sound.playMusic('assets/music/' + curSong + '.mp3', 0.6);
|
||||||
FlxG.sound.music.pause();
|
FlxG.sound.music.pause();
|
||||||
FlxG.sound.music.onComplete = function()
|
FlxG.sound.music.onComplete = function()
|
||||||
|
@ -183,7 +197,7 @@ class ChartingState extends MusicBeatState
|
||||||
|
|
||||||
if (FlxG.keys.justPressed.ENTER)
|
if (FlxG.keys.justPressed.ENTER)
|
||||||
{
|
{
|
||||||
PlayState.SONG = new Song(curSong, getNotes(), Conductor.bpm, sections.length);
|
PlayState.SONG = new Song(curSong, sections, Conductor.bpm, sections.length);
|
||||||
FlxG.sound.music.stop();
|
FlxG.sound.music.stop();
|
||||||
FlxG.switchState(new PlayState());
|
FlxG.switchState(new PlayState());
|
||||||
}
|
}
|
||||||
|
@ -308,6 +322,11 @@ class ChartingState extends MusicBeatState
|
||||||
|
|
||||||
private var daSpacing:Float = 0.3;
|
private var daSpacing:Float = 0.3;
|
||||||
|
|
||||||
|
function loadLevel():Void
|
||||||
|
{
|
||||||
|
trace(oldSongData.notes);
|
||||||
|
}
|
||||||
|
|
||||||
function getNotes():Array<Dynamic>
|
function getNotes():Array<Dynamic>
|
||||||
{
|
{
|
||||||
var noteData:Array<Dynamic> = [];
|
var noteData:Array<Dynamic> = [];
|
||||||
|
|
|
@ -427,6 +427,11 @@ class PlayState extends MusicBeatState
|
||||||
openSubState(new PauseSubState());
|
openSubState(new PauseSubState());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (FlxG.keys.justPressed.ESCAPE)
|
||||||
|
{
|
||||||
|
FlxG.switchState(new ChartingState());
|
||||||
|
}
|
||||||
|
|
||||||
FlxG.watch.addQuick('VOL', vocals.amplitudeLeft);
|
FlxG.watch.addQuick('VOL', vocals.amplitudeLeft);
|
||||||
FlxG.watch.addQuick('VOLRight', vocals.amplitudeRight);
|
FlxG.watch.addQuick('VOLRight', vocals.amplitudeRight);
|
||||||
|
|
||||||
|
|
|
@ -6,9 +6,10 @@ import lime.utils.Assets;
|
||||||
class Song
|
class Song
|
||||||
{
|
{
|
||||||
public var song:String;
|
public var song:String;
|
||||||
public var notes:Array<Dynamic>;
|
public var notes:Array<Section>;
|
||||||
public var bpm:Int;
|
public var bpm:Int;
|
||||||
public var sections:Int;
|
public var sections:Int;
|
||||||
|
public var sectionLengths:Array<Dynamic> = [];
|
||||||
|
|
||||||
public function new(song, notes, bpm, sections)
|
public function new(song, notes, bpm, sections)
|
||||||
{
|
{
|
||||||
|
@ -16,14 +17,20 @@ class Song
|
||||||
this.notes = notes;
|
this.notes = notes;
|
||||||
this.bpm = bpm;
|
this.bpm = bpm;
|
||||||
this.sections = sections;
|
this.sections = sections;
|
||||||
|
|
||||||
|
for (i in 0...notes.length)
|
||||||
|
{
|
||||||
|
this.sectionLengths.push(notes[i]);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function loadFromJson(jsonInput:String):Song
|
public static function loadFromJson(jsonInput:String):Song
|
||||||
{
|
{
|
||||||
var daNotes:Array<Dynamic> = [];
|
var daNotes:Array<Section> = [];
|
||||||
var daBpm:Int = 0;
|
var daBpm:Int = 0;
|
||||||
var daSections:Int = 0;
|
var daSections:Int = 0;
|
||||||
var daSong:String = '';
|
var daSong:String = '';
|
||||||
|
var daSectionLengths:Array<Int> = [];
|
||||||
|
|
||||||
var songData = Json.parse(Assets.getText('assets/data/' + jsonInput + '/' + jsonInput + '.json'));
|
var songData = Json.parse(Assets.getText('assets/data/' + jsonInput + '/' + jsonInput + '.json'));
|
||||||
|
|
||||||
|
@ -31,6 +38,7 @@ class Song
|
||||||
daSong = songData.song;
|
daSong = songData.song;
|
||||||
daSections = songData.sections;
|
daSections = songData.sections;
|
||||||
daBpm = songData.bpm;
|
daBpm = songData.bpm;
|
||||||
|
daSectionLengths = songData.sectionLengths;
|
||||||
|
|
||||||
return new Song(daSong, daNotes, daBpm, daSections);
|
return new Song(daSong, daNotes, daBpm, daSections);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue