1
0
Fork 0
mirror of https://github.com/ninjamuffin99/Funkin.git synced 2024-12-27 07:27:12 +00:00

redoing and replacing some of the music logic

This commit is contained in:
Cameron Taylor 2020-10-09 19:39:52 -07:00
parent f168200b45
commit 4d4a724d72
3 changed files with 75 additions and 38 deletions

11
source/ChartingState.hx Normal file
View file

@ -0,0 +1,11 @@
package;
import flixel.FlxState;
class ChartingState extends FlxState
{
override function create()
{
super.create();
}
}

53
source/MusicBeatState.hx Normal file
View file

@ -0,0 +1,53 @@
package;
import flixel.addons.transition.FlxTransitionableState;
class MusicBeatState extends FlxTransitionableState
{
private var lastBeat:Float = 0;
private var lastStep:Float = 0;
private var totalBeats:Int = 0;
private var totalSteps:Int = 0;
override function create()
{
super.create();
}
private function everyBeat():Void
{
if (Conductor.songPosition > lastBeat + Conductor.crochet - Conductor.safeZoneOffset
|| Conductor.songPosition < lastBeat + Conductor.safeZoneOffset)
{
if (Conductor.songPosition > lastBeat + Conductor.crochet)
{
beatHit();
}
}
}
private function everyStep():Void
{
if (Conductor.songPosition > lastStep + Conductor.stepCrochet - Conductor.safeZoneOffset
|| Conductor.songPosition < lastStep + Conductor.safeZoneOffset)
{
if (Conductor.songPosition > lastStep + Conductor.stepCrochet)
{
stepHit();
}
}
}
public function stepHit():Void
{
totalSteps += 1;
lastStep += Conductor.stepCrochet;
}
public function beatHit():Void
{
lastBeat += Conductor.crochet;
totalBeats += 1;
}
}

View file

@ -26,17 +26,12 @@ import lime.utils.Assets;
using StringTools;
class PlayState extends FlxTransitionableState
class PlayState extends MusicBeatState
{
public static var curLevel:String = 'Bopeebo';
private var lastBeat:Float = 0;
private var lastStep:Float = 0;
private var vocals:FlxSound;
private var totalBeats:Int = 0;
private var totalSteps:Int = 0;
private var dad:Dad;
private var gf:Girlfriend;
private var boyfriend:Boyfriend;
@ -1026,42 +1021,20 @@ class PlayState extends FlxTransitionableState
}
}
private function everyBeat():Void
override function beatHit()
{
if (Conductor.songPosition > lastBeat + Conductor.crochet - Conductor.safeZoneOffset
|| Conductor.songPosition < lastBeat + Conductor.safeZoneOffset)
{
if (Conductor.songPosition > lastBeat + Conductor.crochet)
{
lastBeat += Conductor.crochet;
super.beatHit();
if (camZooming && FlxG.camera.zoom < 1.35 && totalBeats % 4 == 0)
FlxG.camera.zoom += 0.025;
if (camZooming && FlxG.camera.zoom < 1.35 && totalBeats % 4 == 0)
FlxG.camera.zoom += 0.025;
totalBeats += 1;
dad.playAnim('idle');
healthHeads.setGraphicSize(Std.int(healthHeads.width + 20));
dad.playAnim('idle');
healthHeads.setGraphicSize(Std.int(healthHeads.width + 20));
if (totalBeats % gfSpeed == 0)
gf.dance();
if (totalBeats % gfSpeed == 0)
gf.dance();
if (!boyfriend.animation.curAnim.name.startsWith("sing"))
boyfriend.playAnim('idle');
}
}
}
private function everyStep():Void
{
if (Conductor.songPosition > lastStep + Conductor.stepCrochet - Conductor.safeZoneOffset
|| Conductor.songPosition < lastStep + Conductor.safeZoneOffset)
{
if (Conductor.songPosition > lastStep + Conductor.stepCrochet)
{
totalSteps += 1;
lastStep += Conductor.stepCrochet;
}
}
if (!boyfriend.animation.curAnim.name.startsWith("sing"))
boyfriend.playAnim('idle');
}
}