Skip to content

Instantly share code, notes, and snippets.

@EliteMasterEric
Created July 31, 2022 23:34
Show Gist options
  • Save EliteMasterEric/1b1bdd8836dd5b65f75a8ea4e3fa49ff to your computer and use it in GitHub Desktop.
Save EliteMasterEric/1b1bdd8836dd5b65f75a8ea4e3fa49ff to your computer and use it in GitHub Desktop.
Throw this into a mod folder when the next FNF update comes out.
import flixel.FlxG;
import flixel.system.FlxSound;
import flixel.tweens.FlxEase;
import flixel.tweens.FlxTween;
import funkin.modding.module.Module;
import funkin.Paths;
import funkin.TitleState;
class CarCrashMenu extends Module
{
public function new()
{
// Create a module with the ID 'custom-main-menu'
super('car-crash-menu');
carSound = new FlxSound().loadEmbedded(Paths.sound('carCrash'), false, false);
}
var menuItemMaxX:Int = 0;
var menuItemMaxY:Int = 0;
var carSound:FlxSound;
var target:FlxSprite;
var targetX:Float = 0;
var targetY:Float = 0;
override function onUpdate(event:UpdateScriptEvent) {
super.onUpdate(event);
if (target == null) {
if (Std.isOfType(FlxG.state, TitleState)) {
trace('On title screen, capturing target...');
if (FlxG.state.gfDance != null) {
target = FlxG.state.gfDance;
trace('Target captured.');
targetX = target.x;
targetY = target.y;
}
}
} else {
if (FlxG.state.controls.UI_LEFT_P) {
FlxTween.tween(target, {x: -5000 }, 0.6, {ease: FlxEase.expoIn});
}
if (FlxG.state.controls.UI_RIGHT_P) {
FlxTween.tween(target, {x: 5000 }, 0.6, {ease: FlxEase.expoIn});
}
if (FlxG.state.controls.UI_UP_P) {
FlxTween.tween(target, {y: -5000 }, 0.6, {ease: FlxEase.expoIn});
}
if (FlxG.state.controls.UI_DOWN_P) {
FlxTween.tween(target, {y: 5000 }, 0.6, {ease: FlxEase.expoIn});
}
if (Math.abs(target.x) > 4500 || Math.abs(target.y) > 4500) {
carSound.play(true);
FlxG.camera.shake(0.05, 0.5);
FlxTween.tween(target, {x: targetX, y:targetY }, 0.6, {ease: FlxEase.expoOut});
}
}
}
}
Copy link

ghost commented Aug 1, 2022

eric you gotta stop leaking this stuff man, you just spoiled week 14, "damn flat tire"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment