11/24/2020
This commit is contained in:
@ -384,6 +384,8 @@ class ChartingState extends MusicBeatState
|
||||
|
||||
override function update(elapsed:Float)
|
||||
{
|
||||
curStep = recalculateSteps();
|
||||
|
||||
Conductor.songPosition = FlxG.sound.music.time;
|
||||
_song.song = typingShit.text;
|
||||
|
||||
@ -391,7 +393,7 @@ class ChartingState extends MusicBeatState
|
||||
|
||||
if (curBeat % 4 == 0)
|
||||
{
|
||||
if (curStep > lengthBpmBullshit() * (curSection + 1))
|
||||
if (curStep > 16 * (curSection + 1))
|
||||
{
|
||||
trace(curStep);
|
||||
trace((_song.notes[curSection].lengthInSteps) * (curSection + 1));
|
||||
@ -406,6 +408,9 @@ class ChartingState extends MusicBeatState
|
||||
}
|
||||
}
|
||||
|
||||
FlxG.watch.addQuick('daBeat', curBeat);
|
||||
FlxG.watch.addQuick('daStep', curStep);
|
||||
|
||||
if (FlxG.mouse.justPressed)
|
||||
{
|
||||
if (FlxG.mouse.overlaps(curRenderedNotes))
|
||||
@ -517,6 +522,28 @@ class ChartingState extends MusicBeatState
|
||||
super.update(elapsed);
|
||||
}
|
||||
|
||||
function recalculateSteps():Int
|
||||
{
|
||||
var steps:Int = 0;
|
||||
var timeShit:Float = 0;
|
||||
|
||||
for (i in 0...curSection)
|
||||
{
|
||||
steps += 16;
|
||||
|
||||
if (_song.notes[i].changeBPM)
|
||||
timeShit += (((60 / _song.notes[i].bpm) * 1000) / 4) * 16;
|
||||
else
|
||||
timeShit += (((60 / _song.bpm) * 1000) / 4) * 16;
|
||||
}
|
||||
|
||||
steps += Math.floor((FlxG.sound.music.time - timeShit) / Conductor.stepCrochet);
|
||||
curStep = steps;
|
||||
updateBeat();
|
||||
|
||||
return curStep;
|
||||
}
|
||||
|
||||
function changeSection(sec:Int = 0, ?updateMusic:Bool = true):Void
|
||||
{
|
||||
trace('changing section' + sec);
|
||||
@ -699,7 +726,7 @@ class ChartingState extends MusicBeatState
|
||||
|
||||
private function addNote():Void
|
||||
{
|
||||
var noteStrum = getStrumTime(dummyArrow.y) + (curSection * (Conductor.stepCrochet * lengthBpmBullshit()));
|
||||
var noteStrum = getStrumTime(dummyArrow.y) + (curSection * (Conductor.stepCrochet * 16));
|
||||
var noteData = Math.floor(FlxG.mouse.x / GRID_SIZE);
|
||||
var noteSus = 0;
|
||||
|
||||
|
@ -24,14 +24,17 @@ class FreeplayState extends MusicBeatState
|
||||
var intendedScore:Int = 0;
|
||||
|
||||
private var grpSongs:FlxTypedGroup<Alphabet>;
|
||||
private var curPlaying:Bool = false;
|
||||
|
||||
override function create()
|
||||
{
|
||||
if (FlxG.sound.music != null)
|
||||
{
|
||||
if (!FlxG.sound.music.playing)
|
||||
FlxG.sound.playMusic('assets/music/freakyMenu' + TitleState.soundExt);
|
||||
}
|
||||
/*
|
||||
if (FlxG.sound.music != null)
|
||||
{
|
||||
if (!FlxG.sound.music.playing)
|
||||
FlxG.sound.playMusic('assets/music/freakyMenu' + TitleState.soundExt);
|
||||
}
|
||||
*/
|
||||
|
||||
var isDebug:Bool = false;
|
||||
|
||||
@ -118,6 +121,11 @@ class FreeplayState extends MusicBeatState
|
||||
{
|
||||
super.update(elapsed);
|
||||
|
||||
if (FlxG.sound.music.volume < 0.7)
|
||||
{
|
||||
FlxG.sound.music.volume += 0.5 * FlxG.elapsed;
|
||||
}
|
||||
|
||||
lerpScore = Math.floor(FlxMath.lerp(lerpScore, intendedScore, 0.4));
|
||||
|
||||
if (Math.abs(lerpScore - intendedScore) <= 10)
|
||||
@ -151,6 +159,7 @@ class FreeplayState extends MusicBeatState
|
||||
if (accepted)
|
||||
{
|
||||
var poop:String = Highscore.formatSong(songs[curSelected].toLowerCase(), curDifficulty);
|
||||
|
||||
trace(poop);
|
||||
|
||||
PlayState.SONG = Song.loadFromJson(poop, songs[curSelected].toLowerCase());
|
||||
@ -192,6 +201,9 @@ class FreeplayState extends MusicBeatState
|
||||
NGio.logEvent('Fresh');
|
||||
#end
|
||||
|
||||
// NGio.logEvent('Fresh');
|
||||
FlxG.sound.play('assets/sounds/scrollMenu' + TitleState.soundExt, 0.4);
|
||||
|
||||
curSelected += change;
|
||||
|
||||
if (curSelected < 0)
|
||||
@ -206,6 +218,8 @@ class FreeplayState extends MusicBeatState
|
||||
// lerpScore = 0;
|
||||
#end
|
||||
|
||||
FlxG.sound.playMusic('assets/music/' + songs[curSelected] + "_Inst" + TitleState.soundExt, 0);
|
||||
|
||||
var bullShit:Int = 0;
|
||||
|
||||
for (item in grpSongs.members)
|
||||
|
@ -113,7 +113,11 @@ class MainMenuState extends MusicBeatState
|
||||
{
|
||||
if (optionShit[curSelected] == 'donate')
|
||||
{
|
||||
#if linux
|
||||
Sys.command('/usr/bin/xdg-open', ["https://ninja-muffin24.itch.io/funkin", "&"]);
|
||||
#else
|
||||
FlxG.openURL('https://ninja-muffin24.itch.io/funkin');
|
||||
#end
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -34,11 +34,17 @@ class MusicBeatState extends FlxUIState
|
||||
everyStep();
|
||||
|
||||
updateCurStep();
|
||||
curBeat = Math.floor(curStep / 4);
|
||||
// Needs to be ROUNED, rather than ceil or floor
|
||||
updateBeat();
|
||||
|
||||
super.update(elapsed);
|
||||
}
|
||||
|
||||
private function updateBeat():Void
|
||||
{
|
||||
curBeat = Math.round(curStep / 4);
|
||||
}
|
||||
|
||||
/**
|
||||
* CHECKS EVERY FRAME
|
||||
*/
|
||||
@ -64,6 +70,13 @@ class MusicBeatState extends FlxUIState
|
||||
totalSteps += 1;
|
||||
lastStep += Conductor.stepCrochet;
|
||||
|
||||
// If the song is at least 3 steps behind
|
||||
if (Conductor.songPosition > lastStep + (Conductor.stepCrochet * 3))
|
||||
{
|
||||
lastStep = Conductor.songPosition;
|
||||
totalSteps = Math.ceil(lastStep / Conductor.stepCrochet);
|
||||
}
|
||||
|
||||
if (totalSteps % 4 == 0)
|
||||
beatHit();
|
||||
}
|
||||
|
@ -4,38 +4,124 @@ import Controls.Control;
|
||||
import flixel.FlxG;
|
||||
import flixel.FlxSprite;
|
||||
import flixel.FlxSubState;
|
||||
import flixel.group.FlxGroup.FlxTypedGroup;
|
||||
import flixel.input.keyboard.FlxKey;
|
||||
import flixel.system.FlxSound;
|
||||
import flixel.util.FlxColor;
|
||||
|
||||
class PauseSubState extends FlxSubState
|
||||
class PauseSubState extends MusicBeatSubstate
|
||||
{
|
||||
var grpMenuShit:FlxTypedGroup<Alphabet>;
|
||||
|
||||
var menuItems:Array<String> = ['Resume', 'Restart Song', 'Exit to menu'];
|
||||
var curSelected:Int = 0;
|
||||
|
||||
var pauseMusic:FlxSound;
|
||||
|
||||
public function new(x:Float, y:Float)
|
||||
{
|
||||
super();
|
||||
|
||||
pauseMusic = new FlxSound().loadEmbedded('assets/music/breakfast' + TitleState.soundExt, true, true);
|
||||
pauseMusic.volume = 0;
|
||||
pauseMusic.play(false, FlxG.random.int(0, Std.int(pauseMusic.length / 2)));
|
||||
|
||||
FlxG.sound.list.add(pauseMusic);
|
||||
|
||||
var bg:FlxSprite = new FlxSprite().makeGraphic(FlxG.width, FlxG.height, FlxColor.BLACK);
|
||||
bg.alpha = 0.6;
|
||||
bg.scrollFactor.set();
|
||||
add(bg);
|
||||
|
||||
var bf:Boyfriend = new Boyfriend(x, y);
|
||||
bf.scrollFactor.set();
|
||||
// add(bf);
|
||||
grpMenuShit = new FlxTypedGroup<Alphabet>();
|
||||
add(grpMenuShit);
|
||||
|
||||
bf.playAnim('firstDeath');
|
||||
for (i in 0...menuItems.length)
|
||||
{
|
||||
var songText:Alphabet = new Alphabet(0, (70 * i) + 30, menuItems[i], true, false);
|
||||
songText.isMenuItem = true;
|
||||
songText.targetY = i;
|
||||
grpMenuShit.add(songText);
|
||||
}
|
||||
|
||||
bg.cameras = [FlxG.cameras.list[1]];
|
||||
changeSelection();
|
||||
|
||||
cameras = [FlxG.cameras.list[1]];
|
||||
}
|
||||
|
||||
override function update(elapsed:Float)
|
||||
{
|
||||
if (pauseMusic.volume < 0.5)
|
||||
pauseMusic.volume += 0.01 * elapsed;
|
||||
|
||||
super.update(elapsed);
|
||||
|
||||
var upP = controls.UP_P;
|
||||
var downP = controls.DOWN_P;
|
||||
var accepted = controls.ACCEPT;
|
||||
|
||||
if (upP)
|
||||
{
|
||||
changeSelection(-1);
|
||||
}
|
||||
if (downP)
|
||||
{
|
||||
changeSelection(1);
|
||||
}
|
||||
|
||||
if (accepted)
|
||||
{
|
||||
var daSelected:String = menuItems[curSelected];
|
||||
|
||||
switch (daSelected)
|
||||
{
|
||||
case "Resume":
|
||||
close();
|
||||
case "Restart Song":
|
||||
FlxG.resetState();
|
||||
case "Exit to menu":
|
||||
FlxG.switchState(new MainMenuState());
|
||||
}
|
||||
}
|
||||
|
||||
if (FlxG.keys.justPressed.J)
|
||||
{
|
||||
PlayerSettings.player1.controls.replaceBinding(Control.LEFT, Keys, FlxKey.J, null);
|
||||
// for reference later!
|
||||
// PlayerSettings.player1.controls.replaceBinding(Control.LEFT, Keys, FlxKey.J, null);
|
||||
}
|
||||
}
|
||||
|
||||
if (FlxG.keys.justPressed.ENTER)
|
||||
close();
|
||||
override function destroy()
|
||||
{
|
||||
pauseMusic.destroy();
|
||||
|
||||
super.destroy();
|
||||
}
|
||||
|
||||
function changeSelection(change:Int = 0):Void
|
||||
{
|
||||
curSelected += change;
|
||||
|
||||
if (curSelected < 0)
|
||||
curSelected = menuItems.length - 1;
|
||||
if (curSelected >= menuItems.length)
|
||||
curSelected = 0;
|
||||
|
||||
var bullShit:Int = 0;
|
||||
|
||||
for (item in grpMenuShit.members)
|
||||
{
|
||||
item.targetY = bullShit - curSelected;
|
||||
bullShit++;
|
||||
|
||||
item.alpha = 0.6;
|
||||
// item.setGraphicSize(Std.int(item.width * 0.8));
|
||||
|
||||
if (item.targetY == 0)
|
||||
{
|
||||
item.alpha = 1;
|
||||
// item.setGraphicSize(Std.int(item.width));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -83,6 +83,7 @@ class PlayState extends MusicBeatState
|
||||
|
||||
var talking:Bool = true;
|
||||
var songScore:Int = 0;
|
||||
var scoreTxt:FlxText;
|
||||
|
||||
public static var campaignScore:Int = 0;
|
||||
|
||||
@ -252,6 +253,11 @@ class PlayState extends MusicBeatState
|
||||
// healthBar
|
||||
add(healthBar);
|
||||
|
||||
scoreTxt = new FlxText(healthBarBG.x + healthBarBG.width - 190, healthBarBG.y + 30, 0, "", 20);
|
||||
scoreTxt.setFormat("assets/fonts/vcr.ttf", 16, FlxColor.WHITE, RIGHT);
|
||||
scoreTxt.scrollFactor.set();
|
||||
add(scoreTxt);
|
||||
|
||||
healthHeads = new FlxSprite();
|
||||
var headTex = FlxAtlasFrames.fromSparrow(AssetPaths.healthHeads__png, AssetPaths.healthHeads__xml);
|
||||
healthHeads.frames = headTex;
|
||||
@ -277,6 +283,7 @@ class PlayState extends MusicBeatState
|
||||
healthBar.cameras = [camHUD];
|
||||
healthBarBG.cameras = [camHUD];
|
||||
healthHeads.cameras = [camHUD];
|
||||
scoreTxt.cameras = [camHUD];
|
||||
doof.cameras = [camHUD];
|
||||
|
||||
// if (SONG.song == 'South')
|
||||
@ -585,19 +592,18 @@ class PlayState extends MusicBeatState
|
||||
|
||||
private var paused:Bool = false;
|
||||
var startedCountdown:Bool = false;
|
||||
var canPause:Bool = true;
|
||||
|
||||
override public function update(elapsed:Float)
|
||||
{
|
||||
super.update(elapsed);
|
||||
|
||||
//trace("FlxG.elapsed: " + FlxG.elapsed);
|
||||
trace("FlxG.sound.music.time: " + FlxG.sound.music.time);
|
||||
trace("Conductor.songPosition: " + Conductor.songPosition);
|
||||
//trace("FlxG.sound.music.playing: " + FlxG.sound.music.playing);
|
||||
//trace("SONG POS: " + Conductor.songPosition);
|
||||
// FlxG.sound.music.pitch = 2;
|
||||
|
||||
if (FlxG.keys.justPressed.ENTER && startedCountdown)
|
||||
scoreTxt.text = "Score:" + songScore;
|
||||
|
||||
if (FlxG.keys.justPressed.ENTER && startedCountdown && canPause)
|
||||
{
|
||||
persistentUpdate = false;
|
||||
persistentDraw = true;
|
||||
@ -846,6 +852,8 @@ class PlayState extends MusicBeatState
|
||||
|
||||
function endSong():Void
|
||||
{
|
||||
canPause = false;
|
||||
|
||||
#if !switch
|
||||
Highscore.saveScore(SONG.song, songScore, storyDifficulty);
|
||||
#end
|
||||
|
Reference in New Issue
Block a user