From 2a624aff534683823d8e01ebd9ec9df15358f6e4 Mon Sep 17 00:00:00 2001 From: Yoshman29 Date: Wed, 5 Oct 2022 00:06:02 +0200 Subject: [PATCH] second push --- buildnumber.txt | 2 +- source/Boyfriend.hx | 43 --------- source/Main.hx | 16 ++++ source/TitleState.hx | 95 ++++--------------- source/{ => funkin/game}/Character.hx | 43 ++++----- source/{ => funkin/game}/GameOverSubstate.hx | 20 ++-- source/funkin/game/Note.hx | 23 +++-- source/funkin/game/PlayState.hx | 67 ++++--------- source/funkin/game/Strum.hx | 27 +++++- source/{ => funkin/menus}/MainMenuState.hx | 2 +- source/funkin/system/IBeatReceiver.hx | 6 ++ source/{ => funkin/system}/MusicBeatState.hx | 6 +- .../{ => funkin/system}/MusicBeatSubstate.hx | 2 +- source/import.hx | 2 + 14 files changed, 135 insertions(+), 219 deletions(-) delete mode 100644 source/Boyfriend.hx rename source/{ => funkin/game}/Character.hx (97%) rename source/{ => funkin/game}/GameOverSubstate.hx (90%) rename source/{ => funkin/menus}/MainMenuState.hx (99%) create mode 100644 source/funkin/system/IBeatReceiver.hx rename source/{ => funkin/system}/MusicBeatState.hx (88%) rename source/{ => funkin/system}/MusicBeatSubstate.hx (98%) diff --git a/buildnumber.txt b/buildnumber.txt index d8263ee9..2b82dfea 100644 --- a/buildnumber.txt +++ b/buildnumber.txt @@ -1 +1 @@ -2 \ No newline at end of file +60 \ No newline at end of file diff --git a/source/Boyfriend.hx b/source/Boyfriend.hx deleted file mode 100644 index c9f87f9b..00000000 --- a/source/Boyfriend.hx +++ /dev/null @@ -1,43 +0,0 @@ -package; - -import flixel.FlxG; -import flixel.FlxSprite; -import flixel.graphics.frames.FlxAtlasFrames; -import flixel.util.FlxTimer; - -using StringTools; - -class Boyfriend extends Character -{ - public var stunned:Bool = false; - - public function new(x:Float, y:Float, ?char:String = 'bf') - { - super(x, y, char, true); - } - - override function update(elapsed:Float) - { - if (!debugMode) - { - if (animation.curAnim.name.startsWith('sing')) - { - holdTimer += elapsed; - } - else - holdTimer = 0; - - if (animation.curAnim.name.endsWith('miss') && animation.curAnim.finished && !debugMode) - { - playAnim('idle', true, false, 10); - } - - if (animation.curAnim.name == 'firstDeath' && animation.curAnim.finished) - { - playAnim('deathLoop'); - } - } - - super.update(elapsed); - } -} diff --git a/source/Main.hx b/source/Main.hx index a4806471..e836ad63 100644 --- a/source/Main.hx +++ b/source/Main.hx @@ -8,6 +8,12 @@ import openfl.display.FPS; import openfl.display.Sprite; import openfl.events.Event; import flixel.FlxG; +import flixel.graphics.FlxGraphic; +import flixel.addons.transition.FlxTransitionableState; +import flixel.addons.transition.FlxTransitionSprite.GraphicTransTileDiamond; +import flixel.addons.transition.TransitionData; +import flixel.math.FlxPoint; +import flixel.math.FlxRect; // TODO: REMOVE TEST import modsfolder.ModsFolder; @@ -91,5 +97,15 @@ class Main extends Sprite ModsFolder.currentModFolder = "B-Sides"; FlxG.fixedTimestep = false; + FlxG.autoPause = false; + + var diamond:FlxGraphic = FlxGraphic.fromClass(GraphicTransTileDiamond); + diamond.persist = true; + diamond.destroyOnNoUse = false; + + FlxTransitionableState.defaultTransIn = new TransitionData(FADE, 0xFF000000, 1, new FlxPoint(0, -1), {asset: diamond, width: 32, height: 32}, + new FlxRect(-200, -200, FlxG.width * 1.4, FlxG.height * 1.4)); + FlxTransitionableState.defaultTransOut = new TransitionData(FADE, 0xFF000000, 0.7, new FlxPoint(0, 1), + {asset: diamond, width: 32, height: 32}, new FlxRect(-200, -200, FlxG.width * 1.4, FlxG.height * 1.4)); } } diff --git a/source/TitleState.hx b/source/TitleState.hx index 53554ab0..841404fb 100644 --- a/source/TitleState.hx +++ b/source/TitleState.hx @@ -10,7 +10,6 @@ import flixel.FlxState; import flixel.addons.display.FlxGridOverlay; import flixel.addons.transition.FlxTransitionSprite.GraphicTransTileDiamond; import flixel.addons.transition.FlxTransitionableState; -import flixel.addons.transition.TransitionData; import flixel.graphics.FlxGraphic; import flixel.graphics.frames.FlxAtlasFrames; import flixel.group.FlxGroup; @@ -69,30 +68,15 @@ class TitleState extends MusicBeatState { if (!initialized) { - var diamond:FlxGraphic = FlxGraphic.fromClass(GraphicTransTileDiamond); - diamond.persist = true; - diamond.destroyOnNoUse = false; - - FlxTransitionableState.defaultTransIn = new TransitionData(FADE, FlxColor.BLACK, 1, new FlxPoint(0, -1), {asset: diamond, width: 32, height: 32}, - new FlxRect(-200, -200, FlxG.width * 1.4, FlxG.height * 1.4)); - FlxTransitionableState.defaultTransOut = new TransitionData(FADE, FlxColor.BLACK, 0.7, new FlxPoint(0, 1), - {asset: diamond, width: 32, height: 32}, new FlxRect(-200, -200, FlxG.width * 1.4, FlxG.height * 1.4)); - - transIn = FlxTransitionableState.defaultTransIn; - transOut = FlxTransitionableState.defaultTransOut; - FlxG.sound.playMusic(Paths.music('freakyMenu'), 0); - FlxG.sound.music.fadeIn(4, 0, 0.7); } + FlxTransitionableState.skipNextTransIn = true; Conductor.changeBPM(102); persistentUpdate = true; var bg:FlxSprite = new FlxSprite().makeGraphic(FlxG.width, FlxG.height, FlxColor.BLACK); - // bg.antialiasing = true; - // bg.setGraphicSize(Std.int(bg.width * 0.6)); - // bg.updateHitbox(); add(bg); logoBl = new FlxSprite(-150, -100); @@ -101,8 +85,6 @@ class TitleState extends MusicBeatState logoBl.animation.addByPrefix('bump', 'logo bumpin', 24); logoBl.animation.play('bump'); logoBl.updateHitbox(); - // logoBl.screenCenter(); - // logoBl.color = FlxColor.BLACK; gfDance = new FlxSprite(FlxG.width * 0.4, FlxG.height * 0.07); gfDance.frames = Paths.getSparrowAtlas('gfDanceTitle'); @@ -119,7 +101,6 @@ class TitleState extends MusicBeatState titleText.antialiasing = true; titleText.animation.play('idle'); titleText.updateHitbox(); - // titleText.screenCenter(X); add(titleText); var logo:FlxSprite = new FlxSprite().loadGraphic(Paths.image('logo')); @@ -183,14 +164,9 @@ class TitleState extends MusicBeatState override function update(elapsed:Float) { - if (FlxG.sound.music != null) - Conductor.songPosition = FlxG.sound.music.time; - // FlxG.watch.addQuick('amp', FlxG.sound.music.amplitude); + if (FlxG.sound.music != null) Conductor.songPosition = FlxG.sound.music.time; - if (FlxG.keys.justPressed.F) - { - FlxG.fullscreen = !FlxG.fullscreen; - } + if (FlxG.keys.justPressed.F) FlxG.fullscreen = !FlxG.fullscreen; var pressedEnter:Bool = FlxG.keys.justPressed.ENTER; @@ -219,9 +195,6 @@ class TitleState extends MusicBeatState if (pressedEnter && !transitioning && skippedIntro) { - // if (Date.now().getDay() == 5) - // NGio.unlockMedal(61034); - titleText.animation.play('press'); FlxG.camera.flash(FlxColor.WHITE, 1); @@ -237,9 +210,7 @@ class TitleState extends MusicBeatState } if (pressedEnter && !skippedIntro) - { skipIntro(); - } super.update(elapsed); } @@ -290,53 +261,19 @@ class TitleState extends MusicBeatState switch (curBeat) { - case 1: - createCoolText(['ninjamuffin99', 'phantomArcade', 'kawaisprite', 'evilsk8er']); - // credTextShit.visible = true; - case 3: - addMoreText('present'); - // credTextShit.text += '\npresent...'; - // credTextShit.addText(); - case 4: - deleteCoolText(); - // credTextShit.visible = false; - // credTextShit.text = 'In association \nwith'; - // credTextShit.screenCenter(); - case 5: - createCoolText(['In association', 'with']); - case 7: - addMoreText('newgrounds'); - ngSpr.visible = true; - // credTextShit.text += '\nNewgrounds'; - case 8: - deleteCoolText(); - ngSpr.visible = false; - // credTextShit.visible = false; - - // credTextShit.text = 'Shoutouts Tom Fulp'; - // credTextShit.screenCenter(); - case 9: - createCoolText([curWacky[0]]); - // credTextShit.visible = true; - case 11: - addMoreText(curWacky[1]); - // credTextShit.text += '\nlmao'; - case 12: - deleteCoolText(); - // credTextShit.visible = false; - // credTextShit.text = "Friday"; - // credTextShit.screenCenter(); - case 13: - addMoreText('Friday'); - // credTextShit.visible = true; - case 14: - addMoreText('Night'); - // credTextShit.text += '\nNight'; - case 15: - addMoreText('Funkin'); // credTextShit.text += '\nFunkin'; - - case 16: - skipIntro(); + case 1: createCoolText(['ninjamuffin99', 'phantomArcade', 'kawaisprite', 'evilsk8er']); + case 3: addMoreText('present'); + case 4: deleteCoolText(); + case 5: createCoolText(['In association', 'with']); + case 7: addMoreText('newgrounds'); ngSpr.visible = true; + case 8: deleteCoolText(); ngSpr.visible = false; + case 9: createCoolText([curWacky[0]]); + case 11: addMoreText(curWacky[1]); + case 12: deleteCoolText(); + case 13: addMoreText('Friday'); + case 14: addMoreText('Night'); + case 15: addMoreText('Funkin'); + case 16: skipIntro(); } } diff --git a/source/Character.hx b/source/funkin/game/Character.hx similarity index 97% rename from source/Character.hx rename to source/funkin/game/Character.hx index 4e3da2b8..aadda9e7 100644 --- a/source/Character.hx +++ b/source/funkin/game/Character.hx @@ -1,5 +1,6 @@ -package; +package funkin.game; +import funkin.system.IBeatReceiver; import flixel.FlxG; import flixel.FlxSprite; import flixel.animation.FlxBaseAnimation; @@ -7,15 +8,18 @@ import flixel.graphics.frames.FlxAtlasFrames; using StringTools; -class Character extends FlxSprite +class Character extends FlxSprite implements IBeatReceiver { + public var stunned:Bool = false; + public var animOffsets:Map>; public var debugMode:Bool = false; public var isPlayer:Bool = false; public var curCharacter:String = 'bf'; - public var holdTimer:Float = 0; + public var lastHit:Float = -5000; + public var dadVar:Float = 4; public function new(x:Float, y:Float, ?character:String = "bf", ?isPlayer:Bool = false) { @@ -138,6 +142,8 @@ class Character extends FlxSprite addOffset("singLEFT", -10, 10); addOffset("singDOWN", 0, -30); + dadVar = 6.1; + playAnim('idle'); case 'spooky': tex = Paths.getSparrowAtlas('spooky_kids_assets'); @@ -526,24 +532,6 @@ class Character extends FlxSprite override function update(elapsed:Float) { - if (!curCharacter.startsWith('bf')) - { - if (animation.curAnim.name.startsWith('sing')) - { - holdTimer += elapsed; - } - - var dadVar:Float = 4; - - if (curCharacter == 'dad') - dadVar = 6.1; - if (holdTimer >= Conductor.stepCrochet * dadVar * 0.001) - { - dance(); - holdTimer = 0; - } - } - switch (curCharacter) { case 'gf': @@ -555,7 +543,7 @@ class Character extends FlxSprite } private var danced:Bool = false; - + /** * FOR GF DANCING SHIT */ @@ -621,6 +609,14 @@ class Character extends FlxSprite } } + public function beatHit(curBeat:Int) { + if ((lastHit + (Conductor.stepCrochet * dadVar) < Conductor.songPosition) || animation.curAnim == null || (!animation.curAnim.name.startsWith("sing") && animation.curAnim.finished)) + dance(); + } + public function stepHit(curStep:Int) { + // nothing + } + public function playAnim(AnimName:String, Force:Bool = false, Reversed:Bool = false, Frame:Int = 0):Void { animation.play(AnimName, Force, Reversed, Frame); @@ -633,6 +629,9 @@ class Character extends FlxSprite else offset.set(0, 0); + if (AnimName.startsWith("sing")) + lastHit = Conductor.songPosition; + if (curCharacter == 'gf') { if (AnimName == 'singLEFT') diff --git a/source/GameOverSubstate.hx b/source/funkin/game/GameOverSubstate.hx similarity index 90% rename from source/GameOverSubstate.hx rename to source/funkin/game/GameOverSubstate.hx index 1d672dbf..13b6e153 100644 --- a/source/GameOverSubstate.hx +++ b/source/funkin/game/GameOverSubstate.hx @@ -1,4 +1,4 @@ -package; +package funkin.game; import flixel.FlxG; import flixel.FlxObject; @@ -9,13 +9,23 @@ import flixel.util.FlxTimer; class GameOverSubstate extends MusicBeatSubstate { - var bf:Boyfriend; + var bf:Character; var camFollow:FlxObject; var stageSuffix:String = ""; - public function new(x:Float, y:Float) + var x:Float = 0; + var y:Float = 0; + + public function new(x:Float, y:Float) { + super(); + this.x = x; + this.y = y; + } + + public override function create() { + super.create(); var daStage = PlayState.curStage; var daBf:String = ''; switch (daStage) @@ -30,11 +40,9 @@ class GameOverSubstate extends MusicBeatSubstate daBf = 'bf'; } - super(); - Conductor.songPosition = 0; - bf = new Boyfriend(x, y, daBf); + bf = new Character(x, y, daBf, true); add(bf); camFollow = new FlxObject(bf.getGraphicMidpoint().x, bf.getGraphicMidpoint().y, 1, 1); diff --git a/source/funkin/game/Note.hx b/source/funkin/game/Note.hx index 68a13428..ea33b6f0 100644 --- a/source/funkin/game/Note.hx +++ b/source/funkin/game/Note.hx @@ -4,6 +4,7 @@ import flixel.FlxSprite; import flixel.graphics.frames.FlxAtlasFrames; import flixel.math.FlxMath; import flixel.util.FlxColor; +import flixel.math.FlxRect; #if polymod import polymod.format.ParseRules.TargetSignatureElement; #end @@ -34,10 +35,6 @@ class Note extends FlxSprite public var noteScore:Float = 1; public static var swagWidth:Float = 160 * 0.7; - public static var PURP_NOTE:Int = 0; - public static var GREEN_NOTE:Int = 2; - public static var BLUE_NOTE:Int = 1; - public static var RED_NOTE:Int = 3; public function new(strumTime:Float, noteData:Int, ?prevNote:Note, ?sustainNote:Bool = false) { @@ -191,12 +188,8 @@ class Note extends FlxSprite tooLate = true; } else - { canBeHit = false; - - if (strumTime <= Conductor.songPosition) - wasGoodHit = true; - } + if (tooLate) { @@ -204,4 +197,16 @@ class Note extends FlxSprite alpha = 0.3; } } + + public function updateClipRect(strum:Strum) { + var t = FlxMath.bound((Conductor.songPosition - strumTime) / (height / (0.45 * FlxMath.roundDecimal(strum.getScrollSpeed(), 2))), 0, 1); + var swagRect = new FlxRect(0, t * frameHeight, frameWidth, frameHeight); + + setClipRect(swagRect); + } + + public function setClipRect(rect:FlxRect) { + // TODO: Shader ClipRect like in Yoshi Engine for smoother sustains + this.clipRect = rect; + } } diff --git a/source/funkin/game/PlayState.hx b/source/funkin/game/PlayState.hx index 0dd2acfa..a5626b41 100644 --- a/source/funkin/game/PlayState.hx +++ b/source/funkin/game/PlayState.hx @@ -59,7 +59,7 @@ class PlayState extends MusicBeatState private var dad:Character; private var gf:Character; - private var boyfriend:Boyfriend; + private var boyfriend:Character; private var notes:FlxTypedGroup; private var unspawnNotes:Array = []; @@ -167,7 +167,7 @@ class PlayState extends MusicBeatState var camPos:FlxPoint = new FlxPoint(dad.getGraphicMidpoint().x, dad.getGraphicMidpoint().y); - boyfriend = new Boyfriend(770, 450, SONG.player1); + boyfriend = new Character(770, 450, SONG.player1, true); add(gf); @@ -431,12 +431,13 @@ class PlayState extends MusicBeatState susLength = susLength / Conductor.stepCrochet; unspawnNotes.push(swagNote); + if (susLength > 0.75) susLength++; for (susNote in 0...Math.floor(susLength)) { oldNote = unspawnNotes[Std.int(unspawnNotes.length - 1)]; - var sustainNote:Note = new Note(daStrumTime + (Conductor.stepCrochet * susNote) + Conductor.stepCrochet, daNoteData, oldNote, true); + var sustainNote:Note = new Note(daStrumTime + (Conductor.stepCrochet * susNote), daNoteData, oldNote, true); sustainNote.scrollFactor.set(); unspawnNotes.push(sustainNote); @@ -929,6 +930,12 @@ class PlayState extends MusicBeatState notes.forEachAlive(function(daNote:Note) { if (!daNote.mustPress && !daNote.wasGoodHit && daNote.strumTime <= Conductor.songPosition) goodNoteHit(daNote); + // TODO: FIXED STEP CROCHET PER NOTES FOR BPM CHANGES + if (daNote.wasGoodHit && daNote.isSustainNote && daNote.strumTime + (Conductor.stepCrochet) < Conductor.songPosition) { + deleteNote(daNote); + return; + } + var strum:Strum = null; for(e in (daNote.mustPress ? playerStrums : cpuStrums).members) { if (e.ID == daNote.noteData % 4) { @@ -939,6 +946,7 @@ class PlayState extends MusicBeatState if (strum == null) return; strum.updateNotePosition(daNote); + strum.updateClipRect(daNote); }); } @@ -1196,7 +1204,7 @@ class PlayState extends MusicBeatState var funcsToExec:ArrayVoid> = []; if (pressed.contains(true)) { funcsToExec.push(function(note:Note) { - if (pressed[note.strumID] && note.isSustainNote && note.mustPress && !note.wasGoodHit) { + if (pressed[note.strumID] && note.isSustainNote && note.canBeHit && note.mustPress && !note.wasGoodHit) { goodNoteHit(note); } }); @@ -1265,35 +1273,6 @@ class PlayState extends MusicBeatState } } - function badNoteCheck() - { - // just double pasting this shit cuz fuk u - // REDO THIS SYSTEM! - var upP = controls.UP_P; - var rightP = controls.RIGHT_P; - var downP = controls.DOWN_P; - var leftP = controls.LEFT_P; - - if (leftP) - noteMiss(0); - if (downP) - noteMiss(1); - if (upP) - noteMiss(2); - if (rightP) - noteMiss(3); - } - - function noteCheck(keyP:Bool, note:Note):Void - { - if (keyP) - goodNoteHit(note); - else - { - badNoteCheck(); - } - } - function goodNoteHit(note:Note):Void { if (!note.wasGoodHit) @@ -1369,11 +1348,6 @@ class PlayState extends MusicBeatState { resyncVocals(); } - - if (dad.curCharacter == 'spooky' && curStep % 4 == 2) - { - // dad.dance(); - } } var lightningStrikeBeat:Int = 0; @@ -1390,15 +1364,8 @@ class PlayState extends MusicBeatState Conductor.changeBPM(SONG.notes[Math.floor(curStep / 16)].bpm); FlxG.log.add('CHANGED BPM!'); } - // else - // Conductor.changeBPM(SONG.bpm); - - // Dad doesnt interupt his own notes - if (SONG.notes[Math.floor(curStep / 16)].mustHitSection) - dad.dance(); } - // FlxG.log.add('change bpm' + SONG.notes[Std.int(curStep / 16)].changeBPM); - + // HARDCODING FOR MILF ZOOMS! if (curSong.toLowerCase() == 'milf' && curBeat >= 168 && curBeat < 200 && camZooming && FlxG.camera.zoom < 1.35) { @@ -1418,10 +1385,10 @@ class PlayState extends MusicBeatState iconP1.updateHitbox(); iconP2.updateHitbox(); - if (curBeat % gfSpeed == 0) - { - gf.dance(); - } + // if (curBeat % gfSpeed == 0) + // { + // gf.dance(); + // } } var curLight:Int = 0; diff --git a/source/funkin/game/Strum.hx b/source/funkin/game/Strum.hx index b6e68fb8..9759e1ee 100644 --- a/source/funkin/game/Strum.hx +++ b/source/funkin/game/Strum.hx @@ -2,23 +2,40 @@ package funkin.game; import flixel.FlxSprite; import flixel.math.FlxMath; +import flixel.math.FlxPoint; class Strum extends FlxSprite { public var cpu = false; public var lastHit:Float = -5000; + public var scrollSpeed:Null = null; // custom scroll speed per strum + + public function getScrollSpeed() { + if (scrollSpeed != null) return scrollSpeed; + if (PlayState.SONG != null) return PlayState.SONG.speed; + return 1; + } + public override function update(elapsed:Float) { super.update(elapsed); if (cpu) { - if (lastHit + (Conductor.crochet) < Conductor.songPosition && getAnim() == "confirm") { + if (lastHit + (Conductor.crochet / 2) < Conductor.songPosition && getAnim() == "confirm") { playAnim("static"); } } } public function updateNotePosition(daNote:Note) { - daNote.y = (y - (Conductor.songPosition - daNote.strumTime) * (0.45 * FlxMath.roundDecimal(PlayState.SONG.speed, 2))); - daNote.x = x; + var offset = FlxPoint.get(daNote.isSustainNote ? ((Note.swagWidth - daNote.width) / 2) : 0, (Conductor.songPosition - daNote.strumTime) * (0.45 * FlxMath.roundDecimal(PlayState.SONG.speed, 2))); + if (daNote.isSustainNote) offset.y -= Note.swagWidth / 2; + // TODO: angle stuff + daNote.x = x + offset.x; + daNote.y = y - offset.y; + } + + public function updateClipRect(daNote:Note) { + if (!daNote.isSustainNote) return; + daNote.updateClipRect(this); } public function updatePlayerInput(pressed:Bool, justPressed:Bool, justReleased:Bool) { @@ -42,13 +59,13 @@ class Strum extends FlxSprite { public function press(time:Float) { lastHit = time; playAnim("confirm"); - centerOffsets(); - centerOrigin(); } public function playAnim(anim:String, force:Bool = true) { var oldAnim = animation.curAnim; animation.play(anim, force); + centerOffsets(); + centerOrigin(); } public function getAnim() { return animation.curAnim == null ? null : animation.curAnim.name; diff --git a/source/MainMenuState.hx b/source/funkin/menus/MainMenuState.hx similarity index 99% rename from source/MainMenuState.hx rename to source/funkin/menus/MainMenuState.hx index 8e7f33ff..408a535e 100644 --- a/source/MainMenuState.hx +++ b/source/funkin/menus/MainMenuState.hx @@ -1,4 +1,4 @@ -package; +package funkin.menus; #if desktop import Discord.DiscordClient; diff --git a/source/funkin/system/IBeatReceiver.hx b/source/funkin/system/IBeatReceiver.hx new file mode 100644 index 00000000..b6bc405b --- /dev/null +++ b/source/funkin/system/IBeatReceiver.hx @@ -0,0 +1,6 @@ +package funkin.system; + +interface IBeatReceiver { + public function beatHit(curBeat:Int):Void; + public function stepHit(curStep:Int):Void; +} \ No newline at end of file diff --git a/source/MusicBeatState.hx b/source/funkin/system/MusicBeatState.hx similarity index 88% rename from source/MusicBeatState.hx rename to source/funkin/system/MusicBeatState.hx index 6deaccdf..d03a5f49 100644 --- a/source/MusicBeatState.hx +++ b/source/funkin/system/MusicBeatState.hx @@ -1,4 +1,4 @@ -package; +package funkin.system; import Conductor.BPMChangeEvent; import flixel.FlxG; @@ -66,12 +66,14 @@ class MusicBeatState extends FlxUIState public function stepHit():Void { + for(e in members) if (e is IBeatReceiver) cast(e, IBeatReceiver).stepHit(curStep); + if (curStep % 4 == 0) beatHit(); } public function beatHit():Void { - //do literally nothing dumbass + for(e in members) if (e is IBeatReceiver) cast(e, IBeatReceiver).beatHit(curBeat); } } diff --git a/source/MusicBeatSubstate.hx b/source/funkin/system/MusicBeatSubstate.hx similarity index 98% rename from source/MusicBeatSubstate.hx rename to source/funkin/system/MusicBeatSubstate.hx index c6da0fb5..8922a05f 100644 --- a/source/MusicBeatSubstate.hx +++ b/source/funkin/system/MusicBeatSubstate.hx @@ -1,4 +1,4 @@ -package; +package funkin.system; import Conductor.BPMChangeEvent; import flixel.FlxG; diff --git a/source/import.hx b/source/import.hx index c6c54328..f22196e7 100644 --- a/source/import.hx +++ b/source/import.hx @@ -1,4 +1,6 @@ #if !macro import Paths; import funkin.game.PlayState; + import funkin.system.MusicBeatState; + import funkin.system.MusicBeatSubstate; #end \ No newline at end of file