why did NOBODY tell me fast cars arent working😭

This commit is contained in:
⍚~Nex
2024-09-20 17:24:08 +02:00
parent 8ee60adfcf
commit 0b22165408
+14 -10
View File
@@ -1,39 +1,43 @@
var fastCarCanDrive:Bool = true;
function create() {
function create()
resetFastCar();
}
function update(elapsed:Float) {
function update(elapsed:Float)
{
if (!fastCarCanDrive && fastCar.x > 2000) {
resetFastCar();
fastCarCanDrive = true;
}
var offset = Math.sin(curBeatFloat / 4) * Math.cos(curBeatFloat / 16) * 85;
// back limo drive
if (Options.lowMemoryMode) {
bgLimo.frameOffset.x = Math.sin(curBeatFloat / 4) * Math.cos(curBeatFloat / 16) * 85;
bgLimo.frameOffset.x = offset;
} else {
for(e in [bgLimo, dancer1, dancer2, dancer3, dancer4, dancer5]) {
e.frameOffset.x = Math.sin(curBeatFloat / 4) * Math.cos(curBeatFloat / 16) * 85;
e.frameOffset.x = offset;
}
}
}
function beatHit(curBeat:Int) {
function beatHit(curBeat:Int)
if (FlxG.random.bool(10) && fastCarCanDrive)
fastCarDrive();
}
function resetFastCar() {
function resetFastCar()
{
fastCar.x = -12600;
fastCar.y = FlxG.random.int(140, 250);
fastCar.velocity.x = 0;
fastCar.moves = false;
fastCarCanDrive = true;
}
function fastCarDrive()
{
FlxG.sound.play(Paths.soundRandom('carPass', 0, 1), 0.7);
fastCar.velocity.x = (FlxG.random.int(170, 220) / FlxG.elapsed) * 3;
fastCar.velocity.x = FlxG.random.int(170, 220) * 60 * 3;
fastCar.moves = true;
fastCarCanDrive = false;
}