Code for my FNF mod that makes a sprite play a set of 4 animations timed to the beat. class HouseNightStage extends Stage { function new() { super('HouseNight'); } var lightShader:FlxRuntimeShader; function buildStage() { super.buildStage(); } //feast your eyes on my disgusting nestled if statements. they're so beautiful function onBeatHit(event:SongTimeScriptEvent):Void { super.onBeatHit(event); if (event.beat % 2 == 0) { getNamedProp('speakerLight').animation.play('speakerLight0'); getNamedProp('houseLight').animation.play('houseLight0'); if (event.beat % 4 == 0) { getNamedProp('speakerLight').animation.play('speakerLight1'); getNamedProp('houseLight').animation.play('houseLight1'); if (event.beat % 6 == 0) { getNamedProp('speakerLight').animation.play('speakerLight2'); getNamedProp('houseLight').animation.play('houseLight2'); if (event.beat % 8 == 0) { getNamedProp('speakerLight').animation.play('speakerLight3'); getNamedProp('houseLight').animation.play('houseLight3'); } } } } }
This singular nestled if statement is the pinnacle of my FNF coding career so far and all it does is make some lights in the background change color every other beat.
#FNF #FridayNightFunkin #Modding #Programming #Coding #Haxeflixel