mirror of
https://github.com/ninjamuffin99/Funkin.git
synced 2025-01-22 20:48:49 +00:00
redoing and replacing some of the music logic
This commit is contained in:
parent
01843e2c1e
commit
9ea345b620
11
source/ChartingState.hx
Normal file
11
source/ChartingState.hx
Normal file
|
@ -0,0 +1,11 @@
|
||||||
|
package;
|
||||||
|
|
||||||
|
import flixel.FlxState;
|
||||||
|
|
||||||
|
class ChartingState extends FlxState
|
||||||
|
{
|
||||||
|
override function create()
|
||||||
|
{
|
||||||
|
super.create();
|
||||||
|
}
|
||||||
|
}
|
53
source/MusicBeatState.hx
Normal file
53
source/MusicBeatState.hx
Normal 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;
|
||||||
|
}
|
||||||
|
}
|
|
@ -26,17 +26,12 @@ import lime.utils.Assets;
|
||||||
|
|
||||||
using StringTools;
|
using StringTools;
|
||||||
|
|
||||||
class PlayState extends FlxTransitionableState
|
class PlayState extends MusicBeatState
|
||||||
{
|
{
|
||||||
public static var curLevel:String = 'Bopeebo';
|
public static var curLevel:String = 'Bopeebo';
|
||||||
|
|
||||||
private var lastBeat:Float = 0;
|
|
||||||
private var lastStep:Float = 0;
|
|
||||||
private var vocals:FlxSound;
|
private var vocals:FlxSound;
|
||||||
|
|
||||||
private var totalBeats:Int = 0;
|
|
||||||
private var totalSteps:Int = 0;
|
|
||||||
|
|
||||||
private var dad:Dad;
|
private var dad:Dad;
|
||||||
private var gf:Girlfriend;
|
private var gf:Girlfriend;
|
||||||
private var boyfriend:Boyfriend;
|
private var boyfriend:Boyfriend;
|
||||||
|
@ -1026,20 +1021,13 @@ class PlayState extends FlxTransitionableState
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private function everyBeat():Void
|
override function beatHit()
|
||||||
{
|
{
|
||||||
if (Conductor.songPosition > lastBeat + Conductor.crochet - Conductor.safeZoneOffset
|
super.beatHit();
|
||||||
|| Conductor.songPosition < lastBeat + Conductor.safeZoneOffset)
|
|
||||||
{
|
|
||||||
if (Conductor.songPosition > lastBeat + Conductor.crochet)
|
|
||||||
{
|
|
||||||
lastBeat += Conductor.crochet;
|
|
||||||
|
|
||||||
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;
|
||||||
|
|
||||||
totalBeats += 1;
|
|
||||||
|
|
||||||
dad.playAnim('idle');
|
dad.playAnim('idle');
|
||||||
healthHeads.setGraphicSize(Std.int(healthHeads.width + 20));
|
healthHeads.setGraphicSize(Std.int(healthHeads.width + 20));
|
||||||
|
|
||||||
|
@ -1050,18 +1038,3 @@ class PlayState extends FlxTransitionableState
|
||||||
boyfriend.playAnim('idle');
|
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;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
Loading…
Reference in a new issue