less note stutter

This commit is contained in:
Cameron Taylor 2020-10-24 02:19:13 -07:00
parent fa46570337
commit 6c7d5b3f1b
11 changed files with 97 additions and 46 deletions

View File

@ -3,13 +3,13 @@ color 0a
cd .. cd ..
@echo on @echo on
echo BUILDING GAME echo BUILDING GAME
lime build windows -debug lime build hl -debug
echo UPLOADING 64 BIT VERSION TO ITCH echo UPLOADING 64 BIT VERSION TO ITCH
butler push ./export/debug/windows/bin ninja-muffin24/funkin:windows-64bit butler push ./export/debug/hl/bin ninja-muffin24/funkin:windows-64bit
lime build windows -debug -32 lime build hl -debug -32
echo UPLOADING 32 BIT VERSION TO ITCH echo UPLOADING 32 BIT VERSION TO ITCH
butler push ./export/debug/windows/bin ninja-muffin24/funkin:windows-32bit butler push ./export/debug/hl/bin ninja-muffin24/funkin:windows-32bit
butler status ninja-muffin24/friday-night-funkin:windows-32bit butler status ninja-muffin24/funkin:windows-32bit
butler status ninja-muffin24/friday-night-funkin:windows-64bit butler status ninja-muffin24/funkin:windows-64bit
echo ITCH SHIT UPDATED LMAOOOOO echo ITCH SHIT UPDATED LMAOOOOO
pause pause

View File

@ -8,4 +8,5 @@ StuffedWombat
mmatt_ugh mmatt_ugh
Squidly Squidly
Luis Luis
GeoKureli GeoKureli
Will Blanton

BIN
assets/music/Dadbattle.ogg Normal file

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -1,5 +1,6 @@
package; package;
import Song.SwagSong;
import flixel.FlxG; import flixel.FlxG;
import flixel.FlxSprite; import flixel.FlxSprite;
import flixel.addons.display.FlxGridOverlay; import flixel.addons.display.FlxGridOverlay;
@ -59,7 +60,7 @@ class ChartingState extends MusicBeatState
var gridBG:FlxSprite; var gridBG:FlxSprite;
var _song:Song; var _song:SwagSong;
var typingShit:FlxInputText; var typingShit:FlxInputText;
/* /*
@ -79,7 +80,7 @@ class ChartingState extends MusicBeatState
_song = PlayState.SONG; _song = PlayState.SONG;
else else
{ {
_song = new Song(curSong, [], Conductor.bpm, 0); _song = Song.loadFromJson('tutorial');
} }
addSection(); addSection();

View File

@ -10,6 +10,7 @@ class Conductor
public static var crochet:Float = ((60 / bpm) * 1000); // beats in milliseconds public static var crochet:Float = ((60 / bpm) * 1000); // beats in milliseconds
public static var stepCrochet:Float = crochet / 4; // steps in milliseconds public static var stepCrochet:Float = crochet / 4; // steps in milliseconds
public static var songPosition:Float; public static var songPosition:Float;
public static var lastSongPos:Float;
public static var offset:Float = 0; public static var offset:Float = 0;
public static var safeFrames:Int = 10; public static var safeFrames:Int = 10;

View File

@ -3,6 +3,7 @@ package;
import flixel.FlxG; import flixel.FlxG;
import flixel.addons.transition.FlxTransitionableState; import flixel.addons.transition.FlxTransitionableState;
import flixel.addons.ui.FlxUIState; import flixel.addons.ui.FlxUIState;
import flixel.util.FlxTimer;
class MusicBeatState extends FlxUIState class MusicBeatState extends FlxUIState
{ {
@ -17,6 +18,10 @@ class MusicBeatState extends FlxUIState
override function create() override function create()
{ {
#if (!web)
TitleState.soundExt = '.ogg';
#end
super.create(); super.create();
} }

View File

@ -1,6 +1,9 @@
package; package;
import Section.SwagSection;
import Song.SwagSong;
import flixel.FlxG; import flixel.FlxG;
import flixel.FlxGame;
import flixel.FlxObject; import flixel.FlxObject;
import flixel.FlxSprite; import flixel.FlxSprite;
import flixel.FlxState; import flixel.FlxState;
@ -29,7 +32,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; public static var SONG:SwagSong;
private var vocals:FlxSound; private var vocals:FlxSound;
@ -239,8 +242,15 @@ class PlayState extends MusicBeatState
}, 5); }, 5);
} }
var previousFrameTime:Int = 0;
var lastReportedPlayheadPosition:Int = 0;
var songTime:Float = 0;
function startSong():Void function startSong():Void
{ {
previousFrameTime = FlxG.game.ticks;
lastReportedPlayheadPosition = 0;
startingSong = false; startingSong = false;
FlxG.sound.playMusic("assets/music/" + SONG.song + "_Inst" + TitleState.soundExt); FlxG.sound.playMusic("assets/music/" + SONG.song + "_Inst" + TitleState.soundExt);
vocals.play(); vocals.play();
@ -270,7 +280,7 @@ class PlayState extends MusicBeatState
notes = new FlxTypedGroup<Note>(); notes = new FlxTypedGroup<Note>();
add(notes); add(notes);
var noteData:Array<Section> = []; var noteData:Array<SwagSection>;
// NEW SHIT // NEW SHIT
noteData = songData.notes; noteData = songData.notes;
@ -378,8 +388,6 @@ class PlayState extends MusicBeatState
return FlxSort.byValues(FlxSort.ASCENDING, Obj1.strumTime, Obj2.strumTime); return FlxSort.byValues(FlxSort.ASCENDING, Obj1.strumTime, Obj2.strumTime);
} }
var sortedNotes:Bool = false;
private function generateStaticArrows(player:Int):Void private function generateStaticArrows(player:Int):Void
{ {
for (i in 0...4) for (i in 0...4)
@ -475,6 +483,9 @@ class PlayState extends MusicBeatState
{ {
super.update(elapsed); super.update(elapsed);
// trace("SONG POS: " + Conductor.songPosition);
// FlxG.sound.music.pitch = 2;
if (FlxG.keys.justPressed.ENTER) if (FlxG.keys.justPressed.ENTER)
{ {
persistentUpdate = false; persistentUpdate = false;
@ -495,7 +506,7 @@ class PlayState extends MusicBeatState
healthHeads.setGraphicSize(Std.int(FlxMath.lerp(100, healthHeads.width, 0.98))); healthHeads.setGraphicSize(Std.int(FlxMath.lerp(100, healthHeads.width, 0.98)));
healthHeads.x = healthBar.x + (healthBar.width * (FlxMath.remapToRange(healthBar.percent, 0, 100, 100, 0) * 0.01)) - (healthHeads.width / 2); healthHeads.x = healthBar.x + (healthBar.width * (FlxMath.remapToRange(healthBar.percent, 0, 100, 100, 0) * 0.01)) - (healthHeads.width / 2);
if (healthBar.percent < 10) if (healthBar.percent < 20)
healthHeads.animation.play('unhealthy'); healthHeads.animation.play('unhealthy');
else else
healthHeads.animation.play('healthy'); healthHeads.animation.play('healthy');
@ -515,8 +526,24 @@ class PlayState extends MusicBeatState
} }
} }
else else
{
Conductor.songPosition = FlxG.sound.music.time; Conductor.songPosition = FlxG.sound.music.time;
songTime += FlxG.game.ticks - previousFrameTime;
previousFrameTime = FlxG.game.ticks;
// Interpolation type beat
if (Conductor.lastSongPos != Conductor.songPosition)
{
songTime = (songTime + Conductor.songPosition) / 2;
Conductor.lastSongPos = Conductor.songPosition;
// Conductor.songPosition += FlxG.elapsed * 1000;
// trace('MISSED FRAME');
}
// Conductor.lastSongPos = FlxG.sound.music.time;
}
var playerTurn:Int = 0; var playerTurn:Int = 0;
if (sectionLengths.length > curSection) if (sectionLengths.length > curSection)
playerTurn = totalBeats % (sectionLengths[curSection] * 8); playerTurn = totalBeats % (sectionLengths[curSection] * 8);
@ -531,7 +558,7 @@ class PlayState extends MusicBeatState
{ {
if (curBeat % 4 == 0) if (curBeat % 4 == 0)
{ {
trace(PlayState.SONG.notes[Std.int(curStep / 16)].mustHitSection); // trace(PlayState.SONG.notes[Std.int(curStep / 16)].mustHitSection);
} }
if (camFollow.x != dad.getMidpoint().x + 150 && !PlayState.SONG.notes[Std.int(curStep / 16)].mustHitSection) if (camFollow.x != dad.getMidpoint().x + 150 && !PlayState.SONG.notes[Std.int(curStep / 16)].mustHitSection)
@ -598,9 +625,6 @@ class PlayState extends MusicBeatState
if (unspawnNotes[0] != null) if (unspawnNotes[0] != null)
{ {
FlxG.watch.addQuick('spsa', unspawnNotes[0].strumTime);
FlxG.watch.addQuick('weed', Conductor.songPosition);
if (unspawnNotes[0].strumTime - Conductor.songPosition < 1500) if (unspawnNotes[0].strumTime - Conductor.songPosition < 1500)
{ {
var dunceNote:Note = unspawnNotes[0]; var dunceNote:Note = unspawnNotes[0];
@ -645,7 +669,7 @@ class PlayState extends MusicBeatState
daNote.destroy(); daNote.destroy();
} }
daNote.y = (strumLine.y - (Conductor.songPosition - daNote.strumTime) * (0.45 * PlayState.SONG.speed)); daNote.y = (strumLine.y - (songTime - daNote.strumTime) * (0.45 * PlayState.SONG.speed));
if (daNote.y < -daNote.height) if (daNote.y < -daNote.height)
{ {
@ -662,10 +686,6 @@ class PlayState extends MusicBeatState
notes.remove(daNote, true); notes.remove(daNote, true);
daNote.destroy(); daNote.destroy();
} }
// one time sort
if (!sortedNotes)
notes.sort(FlxSort.byY, FlxSort.DESCENDING);
}); });
} }
@ -676,8 +696,6 @@ class PlayState extends MusicBeatState
{ {
var noteDiff:Float = Math.abs(strumtime - Conductor.songPosition); var noteDiff:Float = Math.abs(strumtime - Conductor.songPosition);
trace(noteDiff);
// boyfriend.playAnim('hey'); // boyfriend.playAnim('hey');
// vocals.volume = 1; // vocals.volume = 1;
@ -767,9 +785,10 @@ class PlayState extends MusicBeatState
daLoop++; daLoop++;
} }
/*
trace(combo); trace(combo);
trace(seperatedScore); trace(seperatedScore);
*/
coolText.text = Std.string(seperatedScore); coolText.text = Std.string(seperatedScore);
// add(coolText); // add(coolText);
@ -876,7 +895,7 @@ class PlayState extends MusicBeatState
} }
*/ */
FlxG.watch.addQuick('asdfa', upP); // FlxG.watch.addQuick('asdfa', upP);
if ((upP || rightP || downP || leftP) && !boyfriend.stunned && generatedMusic) if ((upP || rightP || downP || leftP) && !boyfriend.stunned && generatedMusic)
{ {
var possibleNotes:Array<Note> = []; var possibleNotes:Array<Note> = [];
@ -894,11 +913,6 @@ class PlayState extends MusicBeatState
{ {
for (daNote in possibleNotes) for (daNote in possibleNotes)
{ {
var purp:Int = Note.PURP_NOTE;
var green:Int = Note.GREEN_NOTE;
var red:Int = Note.RED_NOTE;
var blue:Int = Note.BLUE_NOTE;
switch (daNote.noteData) switch (daNote.noteData)
{ {
case 2: // NOTES YOU JUST PRESSED case 2: // NOTES YOU JUST PRESSED
@ -931,7 +945,7 @@ class PlayState extends MusicBeatState
if ((up || right || down || left) && !boyfriend.stunned && generatedMusic) if ((up || right || down || left) && !boyfriend.stunned && generatedMusic)
{ {
notes.forEach(function(daNote:Note) notes.forEachAlive(function(daNote:Note)
{ {
if (daNote.canBeHit && daNote.mustPress && daNote.isSustainNote) if (daNote.canBeHit && daNote.mustPress && daNote.isSustainNote)
{ {
@ -1144,6 +1158,14 @@ class PlayState extends MusicBeatState
{ {
super.beatHit(); super.beatHit();
if (generatedMusic)
{
notes.forEachAlive(function(daNote:Note)
{
notes.sort(FlxSort.byY, FlxSort.DESCENDING);
});
}
if (camZooming && FlxG.camera.zoom < 1.35 && totalBeats % 4 == 0) if (camZooming && FlxG.camera.zoom < 1.35 && totalBeats % 4 == 0)
FlxG.camera.zoom += 0.025; FlxG.camera.zoom += 0.025;

View File

@ -1,5 +1,13 @@
package; package;
typedef SwagSection =
{
var sectionNotes:Array<Dynamic>;
var lengthInSteps:Int;
var typeOfSection:Int;
var mustHitSection:Bool;
}
class Section class Section
{ {
public var sectionNotes:Array<Dynamic> = []; public var sectionNotes:Array<Dynamic> = [];

View File

@ -1,14 +1,30 @@
package; package;
import Section.SwagSection;
import haxe.Json; import haxe.Json;
import haxe.format.JsonParser;
import lime.utils.Assets; import lime.utils.Assets;
using StringTools; using StringTools;
typedef SwagSong =
{
var song:String;
var notes:Array<SwagSection>;
var bpm:Int;
var sections:Int;
var sectionLengths:Array<Dynamic>;
var needsVoices:Bool;
var speed:Float;
var player1:String;
var player2:String;
}
class Song class Song
{ {
public var song:String; public var song:String;
public var notes:Array<Section>; public var notes:Array<SwagSection>;
public var bpm:Int; public var bpm:Int;
public var sections:Int; public var sections:Int;
public var sectionLengths:Array<Dynamic> = []; public var sectionLengths:Array<Dynamic> = [];
@ -31,14 +47,8 @@ class Song
} }
} }
public static function loadFromJson(jsonInput:String):Song public static function loadFromJson(jsonInput:String):SwagSong
{ {
var daNotes:Array<Section> = [];
var daBpm:Int = 0;
var daSections:Int = 0;
var daSong:String = '';
var daSectionLengths:Array<Int> = [];
var rawJson = Assets.getText('assets/data/' + jsonInput.toLowerCase() + '/' + jsonInput.toLowerCase() + '.json').trim(); var rawJson = Assets.getText('assets/data/' + jsonInput.toLowerCase() + '/' + jsonInput.toLowerCase() + '.json').trim();
while (!rawJson.endsWith("}")) while (!rawJson.endsWith("}"))
@ -47,9 +57,12 @@ class Song
// LOL GOING THROUGH THE BULLSHIT TO CLEAN IDK WHATS STRANGE // LOL GOING THROUGH THE BULLSHIT TO CLEAN IDK WHATS STRANGE
} }
var swagShit:SwagSong = cast Json.parse(rawJson).song;
trace(swagShit.notes[0]);
// FIX THE CASTING ON WINDOWS/NATIVE // FIX THE CASTING ON WINDOWS/NATIVE
var songData:Song = Json.parse(rawJson).song; // Windows??? // Windows???
trace(songData); // trace(songData);
// trace('LOADED FROM JSON: ' + songData.notes); // trace('LOADED FROM JSON: ' + songData.notes);
/* /*
@ -65,6 +78,6 @@ class Song
daBpm = songData.bpm; daBpm = songData.bpm;
daSectionLengths = songData.sectionLengths; */ daSectionLengths = songData.sectionLengths; */
return songData; return swagShit;
} }
} }