mirror of
https://github.com/ninjamuffin99/Funkin.git
synced 2025-03-21 17:39:20 +00:00
ass kicking song
This commit is contained in:
parent
03481344f5
commit
022eded8f9
|
@ -40,8 +40,6 @@ class ChartingState extends MusicBeatState
|
||||||
*/
|
*/
|
||||||
var curSection:Int = 0;
|
var curSection:Int = 0;
|
||||||
|
|
||||||
var sectionInfo:Array<Dynamic>;
|
|
||||||
|
|
||||||
var bpmTxt:FlxText;
|
var bpmTxt:FlxText;
|
||||||
|
|
||||||
var strumLine:FlxSprite;
|
var strumLine:FlxSprite;
|
||||||
|
@ -63,11 +61,6 @@ class ChartingState extends MusicBeatState
|
||||||
|
|
||||||
var typingShit:FlxInputText;
|
var typingShit:FlxInputText;
|
||||||
|
|
||||||
/**
|
|
||||||
* What part of the SECTION it's on, relative to the grid.
|
|
||||||
*/
|
|
||||||
var page:Int = 1;
|
|
||||||
|
|
||||||
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);
|
||||||
|
@ -146,6 +139,19 @@ class ChartingState extends MusicBeatState
|
||||||
loadSong(_song.song);
|
loadSong(_song.song);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
var reloadSongJson:FlxButton = new FlxButton(reloadSong.x, saveButton.y + 30, "Reload JSON", function()
|
||||||
|
{
|
||||||
|
loadJson(_song.song.toLowerCase());
|
||||||
|
});
|
||||||
|
|
||||||
|
var stepperSpeed:FlxUINumericStepper = new FlxUINumericStepper(10, 80, 0.1, 1, 0.1, 10, 1, null);
|
||||||
|
stepperSpeed.value = _song.speed;
|
||||||
|
stepperSpeed.name = 'song_speed';
|
||||||
|
|
||||||
|
var stepperBPM:FlxUINumericStepper = new FlxUINumericStepper(10, 65, 1, 1, 1, 250, 0, null);
|
||||||
|
stepperBPM.value = Conductor.bpm;
|
||||||
|
stepperBPM.name = 'song_bpm';
|
||||||
|
|
||||||
var tab_group_song = new FlxUI(null, UI_box);
|
var tab_group_song = new FlxUI(null, UI_box);
|
||||||
tab_group_song.name = "Song";
|
tab_group_song.name = "Song";
|
||||||
tab_group_song.add(UI_songTitle);
|
tab_group_song.add(UI_songTitle);
|
||||||
|
@ -153,6 +159,9 @@ class ChartingState extends MusicBeatState
|
||||||
tab_group_song.add(check_voices);
|
tab_group_song.add(check_voices);
|
||||||
tab_group_song.add(saveButton);
|
tab_group_song.add(saveButton);
|
||||||
tab_group_song.add(reloadSong);
|
tab_group_song.add(reloadSong);
|
||||||
|
tab_group_song.add(reloadSongJson);
|
||||||
|
tab_group_song.add(stepperBPM);
|
||||||
|
tab_group_song.add(stepperSpeed);
|
||||||
|
|
||||||
UI_box.addGroup(tab_group_song);
|
UI_box.addGroup(tab_group_song);
|
||||||
UI_box.scrollFactor.set();
|
UI_box.scrollFactor.set();
|
||||||
|
@ -172,9 +181,11 @@ class ChartingState extends MusicBeatState
|
||||||
stepperLength.value = _song.notes[curSection].lengthInSteps;
|
stepperLength.value = _song.notes[curSection].lengthInSteps;
|
||||||
stepperLength.name = "section_length";
|
stepperLength.name = "section_length";
|
||||||
|
|
||||||
|
var stepperCopy:FlxUINumericStepper = new FlxUINumericStepper(110, 30, 1, 1, 1, 999, 0);
|
||||||
|
|
||||||
var copyButton:FlxButton = new FlxButton(110, 8, "Copy last section", function()
|
var copyButton:FlxButton = new FlxButton(110, 8, "Copy last section", function()
|
||||||
{
|
{
|
||||||
copySection();
|
copySection(Std.int(stepperCopy.value));
|
||||||
});
|
});
|
||||||
|
|
||||||
check_mustHitSection = new FlxUICheckBox(10, 30, null, null, "Must hit section", 100);
|
check_mustHitSection = new FlxUICheckBox(10, 30, null, null, "Must hit section", 100);
|
||||||
|
@ -188,6 +199,7 @@ class ChartingState extends MusicBeatState
|
||||||
};
|
};
|
||||||
|
|
||||||
tab_group_section.add(stepperLength);
|
tab_group_section.add(stepperLength);
|
||||||
|
tab_group_section.add(stepperCopy);
|
||||||
tab_group_section.add(check_mustHitSection);
|
tab_group_section.add(check_mustHitSection);
|
||||||
tab_group_section.add(copyButton);
|
tab_group_section.add(copyButton);
|
||||||
|
|
||||||
|
@ -249,6 +261,14 @@ class ChartingState extends MusicBeatState
|
||||||
_song.notes[curSection].lengthInSteps = Std.int(nums.value);
|
_song.notes[curSection].lengthInSteps = Std.int(nums.value);
|
||||||
updateGrid();
|
updateGrid();
|
||||||
}
|
}
|
||||||
|
else if (wname == 'song_speed')
|
||||||
|
{
|
||||||
|
_song.speed = nums.value;
|
||||||
|
}
|
||||||
|
else if (wname == 'song_bpm')
|
||||||
|
{
|
||||||
|
Conductor.changeBPM(Std.int(nums.value));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// FlxG.log.add(id + " WEED " + sender + " WEED " + data + " WEED " + params);
|
// FlxG.log.add(id + " WEED " + sender + " WEED " + data + " WEED " + params);
|
||||||
|
@ -398,13 +418,16 @@ class ChartingState extends MusicBeatState
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function copySection()
|
function copySection(?sectionNum:Int = 1)
|
||||||
{
|
{
|
||||||
var daSec = FlxMath.maxInt(curSection, 1);
|
var daSec = FlxMath.maxInt(curSection, sectionNum);
|
||||||
|
|
||||||
for (note in _song.notes[daSec - 1].notes)
|
for (note in _song.notes[daSec - sectionNum].notes)
|
||||||
{
|
{
|
||||||
_song.notes[daSec].notes.push([note[0] + Conductor.stepCrochet * _song.notes[daSec].lengthInSteps, note[1]]);
|
_song.notes[daSec].notes.push([
|
||||||
|
note[0] + Conductor.stepCrochet * (_song.notes[daSec].lengthInSteps * sectionNum),
|
||||||
|
note[1]
|
||||||
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
updateGrid();
|
updateGrid();
|
||||||
|
@ -431,7 +454,7 @@ class ChartingState extends MusicBeatState
|
||||||
{
|
{
|
||||||
var daNoteInfo = i[1];
|
var daNoteInfo = i[1];
|
||||||
|
|
||||||
var note:Note = new Note(i[0], daNoteInfo);
|
var note:Note = new Note(i[0], daNoteInfo % 4);
|
||||||
note.setGraphicSize(GRID_SIZE, GRID_SIZE);
|
note.setGraphicSize(GRID_SIZE, GRID_SIZE);
|
||||||
note.updateHitbox();
|
note.updateHitbox();
|
||||||
note.x = Math.floor(i[1] * GRID_SIZE);
|
note.x = Math.floor(i[1] * GRID_SIZE);
|
||||||
|
@ -450,7 +473,7 @@ class ChartingState extends MusicBeatState
|
||||||
{
|
{
|
||||||
for (i in _song.notes[curSection].notes)
|
for (i in _song.notes[curSection].notes)
|
||||||
{
|
{
|
||||||
if (i[0] == note.strumTime && i[1] == note.noteData)
|
if (i[0] == note.strumTime && i[1] % 4 == note.noteData)
|
||||||
{
|
{
|
||||||
FlxG.log.add('FOUND EVIL NUMBER');
|
FlxG.log.add('FOUND EVIL NUMBER');
|
||||||
_song.notes[curSection].notes.remove(i);
|
_song.notes[curSection].notes.remove(i);
|
||||||
|
@ -525,10 +548,16 @@ class ChartingState extends MusicBeatState
|
||||||
return noteData;
|
return noteData;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function loadJson(song:String):Void
|
||||||
|
{
|
||||||
|
PlayState.SONG = Song.loadFromJson(song);
|
||||||
|
FlxG.resetState();
|
||||||
|
}
|
||||||
|
|
||||||
private function saveLevel()
|
private function saveLevel()
|
||||||
{
|
{
|
||||||
var json = {
|
var json = {
|
||||||
"song": _song.song,
|
"song": _song,
|
||||||
"bpm": Conductor.bpm,
|
"bpm": Conductor.bpm,
|
||||||
"sections": _song.notes.length,
|
"sections": _song.notes.length,
|
||||||
'notes': _song.notes
|
'notes': _song.notes
|
||||||
|
@ -542,8 +571,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.toLowerCase() + ".json");
|
_file.save(data.trim(), json.song.song.toLowerCase() + ".json");
|
||||||
_file.browse();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -71,7 +71,7 @@ class PlayState extends MusicBeatState
|
||||||
persistentDraw = true;
|
persistentDraw = true;
|
||||||
|
|
||||||
if (SONG == null)
|
if (SONG == null)
|
||||||
SONG = Song.loadFromJson('smash');
|
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));
|
||||||
|
@ -270,7 +270,14 @@ class PlayState extends MusicBeatState
|
||||||
sectionScores[1].push(0);
|
sectionScores[1].push(0);
|
||||||
|
|
||||||
var daStrumTime:Float = songNotes[0];
|
var daStrumTime:Float = songNotes[0];
|
||||||
var daNoteData:Int = songNotes[1];
|
var daNoteData:Int = Std.int(songNotes[1] % 4);
|
||||||
|
|
||||||
|
var gottaHitNote:Bool = section.mustHitSection;
|
||||||
|
|
||||||
|
if (songNotes[1] > 3)
|
||||||
|
{
|
||||||
|
gottaHitNote = !section.mustHitSection;
|
||||||
|
}
|
||||||
|
|
||||||
var oldNote:Note;
|
var oldNote:Note;
|
||||||
if (unspawnNotes.length > 0)
|
if (unspawnNotes.length > 0)
|
||||||
|
@ -283,7 +290,7 @@ class PlayState extends MusicBeatState
|
||||||
|
|
||||||
unspawnNotes.push(swagNote);
|
unspawnNotes.push(swagNote);
|
||||||
|
|
||||||
swagNote.mustPress = section.mustHitSection;
|
swagNote.mustPress = gottaHitNote;
|
||||||
|
|
||||||
if (swagNote.mustPress)
|
if (swagNote.mustPress)
|
||||||
{
|
{
|
||||||
|
@ -473,17 +480,19 @@ class PlayState extends MusicBeatState
|
||||||
sectionScored = true;
|
sectionScored = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (playerTurn == 0 && generatedMusic)
|
if (generatedMusic && PlayState.SONG.notes[curBeat % 4] != null)
|
||||||
|
{
|
||||||
|
if (camFollow.x != dad.getGraphicMidpoint().x + 150 && PlayState.SONG.notes[curBeat % 4].mustHitSection)
|
||||||
{
|
{
|
||||||
if (camFollow.x != dad.getGraphicMidpoint().x + 150)
|
|
||||||
camFollow.setPosition(dad.getGraphicMidpoint().x + 150, dad.getGraphicMidpoint().y - 100);
|
camFollow.setPosition(dad.getGraphicMidpoint().x + 150, dad.getGraphicMidpoint().y - 100);
|
||||||
vocals.volume = 1;
|
vocals.volume = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (playerTurn == Std.int((sectionLengths[curSection] * 8) / 2) && camFollow.x != boyfriend.getGraphicMidpoint().x - 100)
|
if (PlayState.SONG.notes[curBeat % 4].mustHitSection && camFollow.x != boyfriend.getGraphicMidpoint().x - 100)
|
||||||
{
|
{
|
||||||
camFollow.setPosition(boyfriend.getGraphicMidpoint().x - 100, boyfriend.getGraphicMidpoint().y - 100);
|
camFollow.setPosition(boyfriend.getGraphicMidpoint().x - 100, boyfriend.getGraphicMidpoint().y - 100);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (camZooming)
|
if (camZooming)
|
||||||
{
|
{
|
||||||
|
@ -584,7 +593,7 @@ class PlayState extends MusicBeatState
|
||||||
daNote.destroy();
|
daNote.destroy();
|
||||||
}
|
}
|
||||||
|
|
||||||
daNote.y = (strumLine.y - (Conductor.songPosition - daNote.strumTime) * 0.45);
|
daNote.y = (strumLine.y - (Conductor.songPosition - daNote.strumTime) * (0.45 * PlayState.SONG.speed));
|
||||||
|
|
||||||
if (daNote.y < -daNote.height)
|
if (daNote.y < -daNote.height)
|
||||||
{
|
{
|
||||||
|
|
|
@ -13,6 +13,7 @@ class Song
|
||||||
public var sections:Int;
|
public var sections:Int;
|
||||||
public var sectionLengths:Array<Dynamic> = [];
|
public var sectionLengths:Array<Dynamic> = [];
|
||||||
public var needsVoices:Bool = true;
|
public var needsVoices:Bool = true;
|
||||||
|
public var speed:Float = 1;
|
||||||
|
|
||||||
public function new(song, notes, bpm, sections)
|
public function new(song, notes, bpm, sections)
|
||||||
{
|
{
|
||||||
|
@ -45,14 +46,16 @@ class Song
|
||||||
|
|
||||||
trace(rawJson);
|
trace(rawJson);
|
||||||
|
|
||||||
var songData = Json.parse(rawJson);
|
var songData:Song = Json.parse(rawJson).song;
|
||||||
|
|
||||||
|
trace('LOADED FROM JSON: ' + songData.song);
|
||||||
|
/*
|
||||||
daNotes = songData.notes;
|
daNotes = songData.notes;
|
||||||
daSong = songData.song;
|
daSong = songData.song;
|
||||||
daSections = songData.sections;
|
daSections = songData.sections;
|
||||||
daBpm = songData.bpm;
|
daBpm = songData.bpm;
|
||||||
daSectionLengths = songData.sectionLengths;
|
daSectionLengths = songData.sectionLengths; */
|
||||||
|
|
||||||
return new Song(daSong, daNotes, daBpm, daSections);
|
return songData;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue