mirror of
https://github.com/ninjamuffin99/Funkin.git
synced 2024-12-27 23:46:45 +00:00
rippin my hair out at programming right now
This commit is contained in:
parent
f3fb40dc5e
commit
78ec82d953
|
@ -62,7 +62,11 @@ class ChartingState extends MusicBeatState
|
||||||
var _song:Song;
|
var _song:Song;
|
||||||
|
|
||||||
var typingShit:FlxInputText;
|
var typingShit:FlxInputText;
|
||||||
var gridSectionOffset:Int = 1;
|
|
||||||
|
/**
|
||||||
|
* What part of the SECTION it's on, relative to the grid.
|
||||||
|
*/
|
||||||
|
var page:Int = 1;
|
||||||
|
|
||||||
override function create()
|
override function create()
|
||||||
{
|
{
|
||||||
|
@ -87,7 +91,8 @@ class ChartingState extends MusicBeatState
|
||||||
loadSong(_song.song);
|
loadSong(_song.song);
|
||||||
Conductor.changeBPM(_song.bpm);
|
Conductor.changeBPM(_song.bpm);
|
||||||
|
|
||||||
bpmTxt = new FlxText(450, 20, 0, "", 16);
|
bpmTxt = new FlxText(1000, 50, 0, "", 16);
|
||||||
|
bpmTxt.scrollFactor.set();
|
||||||
add(bpmTxt);
|
add(bpmTxt);
|
||||||
|
|
||||||
strumLine = new FlxSprite(0, 50).makeGraphic(Std.int(FlxG.width / 2), 4);
|
strumLine = new FlxSprite(0, 50).makeGraphic(Std.int(FlxG.width / 2), 4);
|
||||||
|
@ -150,6 +155,9 @@ class ChartingState extends MusicBeatState
|
||||||
tab_group_song.add(reloadSong);
|
tab_group_song.add(reloadSong);
|
||||||
|
|
||||||
UI_box.addGroup(tab_group_song);
|
UI_box.addGroup(tab_group_song);
|
||||||
|
UI_box.scrollFactor.set();
|
||||||
|
|
||||||
|
FlxG.camera.follow(strumLine);
|
||||||
}
|
}
|
||||||
|
|
||||||
var stepperLength:FlxUINumericStepper;
|
var stepperLength:FlxUINumericStepper;
|
||||||
|
@ -233,23 +241,30 @@ class ChartingState extends MusicBeatState
|
||||||
if (wname == 'section_length')
|
if (wname == 'section_length')
|
||||||
{
|
{
|
||||||
_song.notes[curSection].lengthInSteps = Std.int(nums.value);
|
_song.notes[curSection].lengthInSteps = Std.int(nums.value);
|
||||||
|
updateGrid();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// FlxG.log.add(id + " WEED " + sender + " WEED " + data + " WEED " + params);
|
// FlxG.log.add(id + " WEED " + sender + " WEED " + data + " WEED " + params);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var updatedSection:Bool = false;
|
||||||
|
|
||||||
override function update(elapsed:Float)
|
override function update(elapsed:Float)
|
||||||
{
|
{
|
||||||
Conductor.songPosition = FlxG.sound.music.time;
|
Conductor.songPosition = FlxG.sound.music.time;
|
||||||
_song.song = typingShit.text;
|
_song.song = typingShit.text;
|
||||||
|
|
||||||
strumLine.y = getYfromStrum(Conductor.songPosition % (Conductor.stepCrochet * 16));
|
strumLine.y = getYfromStrum(Conductor.songPosition % (Conductor.stepCrochet * _song.notes[curSection].lengthInSteps));
|
||||||
|
|
||||||
if (curBeat % 4 == 0)
|
if (curBeat % 4 == 0)
|
||||||
{
|
{
|
||||||
if (curStep > (_song.notes[curSection].lengthInSteps * 2) * (curSection + 1))
|
if (curStep > (_song.notes[curSection].lengthInSteps) * (curSection + 1))
|
||||||
{
|
{
|
||||||
|
trace(curStep);
|
||||||
|
trace((_song.notes[curSection].lengthInSteps) * (curSection + 1));
|
||||||
|
trace('DUMBSHIT');
|
||||||
|
|
||||||
if (_song.notes[curSection + 1] == null)
|
if (_song.notes[curSection + 1] == null)
|
||||||
{
|
{
|
||||||
addSection();
|
addSection();
|
||||||
|
@ -259,7 +274,10 @@ class ChartingState extends MusicBeatState
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (FlxG.mouse.overlaps(gridBG))
|
if (FlxG.mouse.x > gridBG.x
|
||||||
|
&& FlxG.mouse.x < gridBG.x + gridBG.width
|
||||||
|
&& FlxG.mouse.y > gridBG.y
|
||||||
|
&& FlxG.mouse.y < gridBG.y + (GRID_SIZE * _song.notes[curSection].lengthInSteps))
|
||||||
{
|
{
|
||||||
dummyArrow.x = Math.floor(FlxG.mouse.x / GRID_SIZE) * GRID_SIZE;
|
dummyArrow.x = Math.floor(FlxG.mouse.x / GRID_SIZE) * GRID_SIZE;
|
||||||
if (FlxG.keys.pressed.SHIFT)
|
if (FlxG.keys.pressed.SHIFT)
|
||||||
|
@ -347,6 +365,8 @@ class ChartingState extends MusicBeatState
|
||||||
|
|
||||||
function changeSection(sec:Int = 0, ?updateMusic:Bool = true):Void
|
function changeSection(sec:Int = 0, ?updateMusic:Bool = true):Void
|
||||||
{
|
{
|
||||||
|
trace('changing section' + sec);
|
||||||
|
|
||||||
if (_song.notes[sec] != null)
|
if (_song.notes[sec] != null)
|
||||||
{
|
{
|
||||||
curSection = sec;
|
curSection = sec;
|
||||||
|
@ -360,11 +380,12 @@ class ChartingState extends MusicBeatState
|
||||||
var daLength:Int = 0;
|
var daLength:Int = 0;
|
||||||
while (daNum <= sec)
|
while (daNum <= sec)
|
||||||
{
|
{
|
||||||
daLength += _song.notes[daNum].lengthInSteps * 2;
|
daLength += _song.notes[daNum].lengthInSteps;
|
||||||
daNum++;
|
daNum++;
|
||||||
}
|
}
|
||||||
|
|
||||||
FlxG.sound.music.time = (daLength - (_song.notes[sec].lengthInSteps * 2)) * Conductor.stepCrochet;
|
FlxG.sound.music.time = (daLength - (_song.notes[sec].lengthInSteps)) * Conductor.stepCrochet;
|
||||||
|
updateCurStep();
|
||||||
}
|
}
|
||||||
|
|
||||||
updateSectionUI();
|
updateSectionUI();
|
||||||
|
@ -444,6 +465,29 @@ class ChartingState extends MusicBeatState
|
||||||
return FlxMath.remapToRange(strumTime, 0, 16 * Conductor.stepCrochet, gridBG.y, gridBG.y + gridBG.height);
|
return FlxMath.remapToRange(strumTime, 0, 16 * Conductor.stepCrochet, gridBG.y, gridBG.y + gridBG.height);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function calculateSectionLengths(?sec:Section):Int
|
||||||
|
{
|
||||||
|
var daLength:Int = 0;
|
||||||
|
|
||||||
|
for (i in _song.notes)
|
||||||
|
{
|
||||||
|
var swagLength = i.lengthInSteps;
|
||||||
|
|
||||||
|
if (i.typeOfSection == Section.COPYCAT)
|
||||||
|
swagLength * 2;
|
||||||
|
|
||||||
|
daLength += swagLength;
|
||||||
|
|
||||||
|
if (sec != null && sec == i)
|
||||||
|
{
|
||||||
|
trace('swag loop??');
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return daLength;
|
||||||
|
}
|
||||||
|
|
||||||
private var daSpacing:Float = 0.3;
|
private var daSpacing:Float = 0.3;
|
||||||
|
|
||||||
function loadLevel():Void
|
function loadLevel():Void
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
package;
|
package;
|
||||||
|
|
||||||
|
import flixel.FlxG;
|
||||||
import flixel.addons.transition.FlxTransitionableState;
|
import flixel.addons.transition.FlxTransitionableState;
|
||||||
import flixel.addons.ui.FlxUIState;
|
import flixel.addons.ui.FlxUIState;
|
||||||
|
|
||||||
|
@ -23,7 +24,7 @@ class MusicBeatState extends FlxUIState
|
||||||
{
|
{
|
||||||
everyStep();
|
everyStep();
|
||||||
|
|
||||||
curStep = Math.floor(Conductor.songPosition / Conductor.stepCrochet);
|
updateCurStep();
|
||||||
curBeat = Math.floor(curStep / 4);
|
curBeat = Math.floor(curStep / 4);
|
||||||
|
|
||||||
super.update(elapsed);
|
super.update(elapsed);
|
||||||
|
@ -44,6 +45,12 @@ class MusicBeatState extends FlxUIState
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private function updateCurStep():Void
|
||||||
|
{
|
||||||
|
Conductor.songPosition = FlxG.sound.music.time;
|
||||||
|
curStep = Math.floor(Conductor.songPosition / Conductor.stepCrochet);
|
||||||
|
}
|
||||||
|
|
||||||
public function stepHit():Void
|
public function stepHit():Void
|
||||||
{
|
{
|
||||||
totalSteps += 1;
|
totalSteps += 1;
|
||||||
|
|
|
@ -259,8 +259,6 @@ class PlayState extends MusicBeatState
|
||||||
|
|
||||||
var playerCounter:Int = 0;
|
var playerCounter:Int = 0;
|
||||||
|
|
||||||
while (playerCounter < 2)
|
|
||||||
{
|
|
||||||
var daBeats:Int = 0; // Not exactly representative of 'daBeats' lol, just how much it has looped
|
var daBeats:Int = 0; // Not exactly representative of 'daBeats' lol, just how much it has looped
|
||||||
var totalLength:Int = 0; // Total length of the song, in beats;
|
var totalLength:Int = 0; // Total length of the song, in beats;
|
||||||
for (section in noteData)
|
for (section in noteData)
|
||||||
|
@ -279,7 +277,7 @@ class PlayState extends MusicBeatState
|
||||||
sectionScores[0].push(0);
|
sectionScores[0].push(0);
|
||||||
sectionScores[1].push(0);
|
sectionScores[1].push(0);
|
||||||
|
|
||||||
var daStrumTime:Float = songNotes[0] + ((Conductor.stepCrochet * 16) * playerCounter);
|
var daStrumTime:Float = songNotes[0] + (Conductor.stepCrochet * section.lengthInSteps);
|
||||||
trace(daStrumTime);
|
trace(daStrumTime);
|
||||||
var daNoteData:Int = songNotes[1];
|
var daNoteData:Int = songNotes[1];
|
||||||
|
|
||||||
|
@ -296,28 +294,41 @@ class PlayState extends MusicBeatState
|
||||||
|
|
||||||
unspawnNotes.push(swagNote);
|
unspawnNotes.push(swagNote);
|
||||||
|
|
||||||
swagNote.x += ((FlxG.width / 2) * playerCounter); // general offset
|
swagNote.mustPress = section.mustHitSection;
|
||||||
|
|
||||||
|
if (swagNote.mustPress)
|
||||||
|
{
|
||||||
|
swagNote.x += (FlxG.width / 2); // general offset
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
// WILL HAVE TO REDO SCORE SYSTEM
|
||||||
|
/* if (section.mustHitSection)
|
||||||
|
{
|
||||||
if (playerCounter == 1) // is the player
|
if (playerCounter == 1) // is the player
|
||||||
{
|
{
|
||||||
swagNote.mustPress = true;
|
swagNote.mustPress = true;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
sectionScores[0][daBeats] += swagNote.noteScore;
|
//sectionScores[0][daBeats] += swagNote.noteScore;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
|
}
|
||||||
|
|
||||||
// only need to do it once
|
/* // only need to do it once
|
||||||
if (playerCounter == 0)
|
if (section.mustHitSection)
|
||||||
sectionLengths.push(Math.round(coolSection / 4));
|
sectionLengths.push(Math.round(coolSection / 4));
|
||||||
|
*/
|
||||||
totalLength += Math.round(coolSection / 4);
|
totalLength += Math.round(coolSection / 4);
|
||||||
daBeats += 1;
|
daBeats += 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
trace(unspawnNotes.length);
|
trace(unspawnNotes.length);
|
||||||
playerCounter += 1;
|
// playerCounter += 1;
|
||||||
}
|
|
||||||
|
|
||||||
unspawnNotes.sort(sortByShit);
|
unspawnNotes.sort(sortByShit);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue