1
0
Fork 0
mirror of https://github.com/ninjamuffin99/Funkin.git synced 2024-11-05 06:14:36 +00:00

optimiiiizeeee

This commit is contained in:
Cameron Taylor 2021-04-18 16:54:21 -04:00
parent 157769b41a
commit c60bd8b12f
2 changed files with 79 additions and 73 deletions

View file

@ -649,15 +649,15 @@ class PlayState extends MusicBeatState
gf.x -= 50; gf.x -= 50;
gf.y -= 200; gf.y -= 200;
var tempTankman:TankmenBG = new TankmenBG(20, 500, true);
tempTankman.strumTime = 10;
tempTankman.resetShit(20, 600, true);
tankmanRun.add(tempTankman);
for (i in 0...TankmenBG.animationNotes.length) for (i in 0...TankmenBG.animationNotes.length)
{ {
if (FlxG.random.bool(16)) if (FlxG.random.bool(16))
{ {
var tempTankman:TankmenBG = new TankmenBG(20, 500, true);
tempTankman.strumTime = 10;
tempTankman.resetShit(20, 600, true);
tankmanRun.add(tempTankman);
var tankman:TankmenBG = tankmanRun.recycle(TankmenBG); var tankman:TankmenBG = tankmanRun.recycle(TankmenBG);
// new TankmenBG(500, 200 + FlxG.random.int(50, 100), TankmenBG.animationNotes[i][1] < 2); // new TankmenBG(500, 200 + FlxG.random.int(50, 100), TankmenBG.animationNotes[i][1] < 2);
tankman.strumTime = TankmenBG.animationNotes[i][0]; tankman.strumTime = TankmenBG.animationNotes[i][0];
@ -957,86 +957,87 @@ class PlayState extends MusicBeatState
function ughIntro() function ughIntro()
{ {
inCutscene = true; inCutscene = true;
/*
var blackShit:FlxSprite = new FlxSprite(-200, -200).makeGraphic(FlxG.width * 2, FlxG.height * 2, FlxColor.BLACK);
blackShit.scrollFactor.set();
add(blackShit);
var blackShit:FlxSprite = new FlxSprite(-200, -200).makeGraphic(FlxG.width * 2, FlxG.height * 2, FlxColor.BLACK); var vid:FlxVideo = new FlxVideo('music/ughCutscene.mp4');
blackShit.scrollFactor.set(); vid.finishCallback = function()
add(blackShit); {
remove(blackShit);
FlxTween.tween(FlxG.camera, {zoom: defaultCamZoom}, (Conductor.crochet / 1000) * 5, {ease: FlxEase.quadInOut});
startCountdown();
cameraMovement();
};
var vid:FlxVideo = new FlxVideo('music/ughCutscene.mp4'); FlxG.camera.zoom = defaultCamZoom * 1.2;
vid.finishCallback = function()
{
remove(blackShit);
FlxTween.tween(FlxG.camera, {zoom: defaultCamZoom}, (Conductor.crochet / 1000) * 5, {ease: FlxEase.quadInOut});
startCountdown();
cameraMovement();
};
FlxG.camera.zoom = defaultCamZoom * 1.2; camFollow.x += 100;
camFollow.y += 100;
*/
camFollow.x += 100; FlxG.sound.playMusic(Paths.music('DISTORTO'), 0);
FlxG.sound.music.fadeIn(5, 0, 0.5);
dad.visible = false;
var tankCutscene:TankCutscene = new TankCutscene(-20, 320);
tankCutscene.frames = Paths.getSparrowAtlas('cutsceneStuff/tankTalkSong1');
tankCutscene.animation.addByPrefix('wellWell', 'TANK TALK 1 P1', 24, false);
tankCutscene.animation.addByPrefix('killYou', 'TANK TALK 1 P2', 24, false);
tankCutscene.animation.play('wellWell');
tankCutscene.antialiasing = true;
gfCutsceneLayer.add(tankCutscene);
camHUD.visible = false;
FlxG.camera.zoom *= 1.2;
camFollow.y += 100; camFollow.y += 100;
/* FlxG.sound.playMusic(Paths.music('DISTORTO'), 0); tankCutscene.startSyncAudio = FlxG.sound.load(Paths.sound('wellWellWell'));
FlxG.sound.music.fadeIn(5, 0, 0.5);
dad.visible = false; new FlxTimer().start(3, function(tmr:FlxTimer)
var tankCutscene:TankCutscene = new TankCutscene(-20, 320); {
tankCutscene.frames = Paths.getSparrowAtlas('cutsceneStuff/tankTalkSong1'); camFollow.x += 800;
tankCutscene.animation.addByPrefix('wellWell', 'TANK TALK 1 P1', 24, false);
tankCutscene.animation.addByPrefix('killYou', 'TANK TALK 1 P2', 24, false);
tankCutscene.animation.play('wellWell');
tankCutscene.antialiasing = true;
gfCutsceneLayer.add(tankCutscene);
camHUD.visible = false;
FlxG.camera.zoom *= 1.2;
camFollow.y += 100; camFollow.y += 100;
FlxTween.tween(FlxG.camera, {zoom: defaultCamZoom * 1.2}, 0.27, {ease: FlxEase.quadInOut});
tankCutscene.startSyncAudio = FlxG.sound.load(Paths.sound('wellWellWell')); new FlxTimer().start(1.5, function(bep:FlxTimer)
new FlxTimer().start(3, function(tmr:FlxTimer)
{ {
camFollow.x += 800; boyfriend.playAnim('singUP');
camFollow.y += 100; // play sound
FlxTween.tween(FlxG.camera, {zoom: defaultCamZoom * 1.2}, 0.27, {ease: FlxEase.quadInOut}); FlxG.sound.play(Paths.sound('bfBeep'), function()
new FlxTimer().start(1.5, function(bep:FlxTimer)
{ {
boyfriend.playAnim('singUP'); boyfriend.playAnim('idle');
// play sound
FlxG.sound.play(Paths.sound('bfBeep'), function()
{
boyfriend.playAnim('idle');
});
}); });
});
new FlxTimer().start(3, function(swaggy:FlxTimer) new FlxTimer().start(3, function(swaggy:FlxTimer)
{
camFollow.x -= 800;
camFollow.y -= 100;
FlxTween.tween(FlxG.camera, {zoom: defaultCamZoom * 1.2}, 0.5, {ease: FlxEase.quadInOut});
tankCutscene.animation.play('killYou');
FlxG.sound.play(Paths.sound('killYou'));
new FlxTimer().start(6.1, function(swagasdga:FlxTimer)
{ {
camFollow.x -= 800; FlxTween.tween(FlxG.camera, {zoom: defaultCamZoom}, (Conductor.crochet / 1000) * 5, {ease: FlxEase.quadInOut});
camFollow.y -= 100;
FlxTween.tween(FlxG.camera, {zoom: defaultCamZoom * 1.2}, 0.5, {ease: FlxEase.quadInOut}); FlxG.sound.music.fadeOut((Conductor.crochet / 1000) * 5, 0);
tankCutscene.animation.play('killYou');
FlxG.sound.play(Paths.sound('killYou')); new FlxTimer().start((Conductor.crochet / 1000) * 5, function(money:FlxTimer)
new FlxTimer().start(6.1, function(swagasdga:FlxTimer)
{ {
FlxTween.tween(FlxG.camera, {zoom: defaultCamZoom}, (Conductor.crochet / 1000) * 5, {ease: FlxEase.quadInOut}); dad.visible = true;
gfCutsceneLayer.remove(tankCutscene);
FlxG.sound.music.fadeOut((Conductor.crochet / 1000) * 5, 0);
new FlxTimer().start((Conductor.crochet / 1000) * 5, function(money:FlxTimer)
{
dad.visible = true;
gfCutsceneLayer.remove(tankCutscene);
});
cameraMovement();
startCountdown();
camHUD.visible = true;
}); });
cameraMovement();
startCountdown();
camHUD.visible = true;
}); });
});*/ });
});
} }
function gunsIntro() function gunsIntro()
@ -1935,7 +1936,7 @@ class PlayState extends MusicBeatState
vocals.pause(); vocals.pause();
FlxG.sound.music.play(); FlxG.sound.music.play();
Conductor.songPosition = FlxG.sound.music.time; Conductor.songPosition = FlxG.sound.music.time + Conductor.offset;
if (vocalsFinished) if (vocalsFinished)
return; return;
@ -1972,8 +1973,8 @@ class PlayState extends MusicBeatState
} }
else else
{ {
// Conductor.songPosition = FlxG.sound.music.time; Conductor.songPosition = FlxG.sound.music.time + Conductor.offset; // 20 is THE MILLISECONDS??
Conductor.songPosition += FlxG.elapsed * 1000; // Conductor.songPosition += FlxG.elapsed * 1000;
if (!paused) if (!paused)
{ {
@ -2977,8 +2978,8 @@ class PlayState extends MusicBeatState
override function stepHit() override function stepHit()
{ {
super.stepHit(); super.stepHit();
if (Math.abs(FlxG.sound.music.time - Conductor.songPosition) > 20 if (Math.abs(FlxG.sound.music.time - (Conductor.songPosition - Conductor.offset)) > 20
|| (SONG.needsVoices && Math.abs(vocals.time - Conductor.songPosition) > 20)) || (SONG.needsVoices && Math.abs(vocals.time - (Conductor.songPosition - Conductor.offset)) > 20))
{ {
resyncVocals(); resyncVocals();
} }

View file

@ -49,6 +49,11 @@ class TankmenBG extends FlxSprite
{ {
super.update(elapsed); super.update(elapsed);
if (x >= FlxG.width * 1.2 || x <= FlxG.width * -0.5)
visible = false;
else
visible = true;
if (animation.curAnim.name == 'run') if (animation.curAnim.name == 'run')
{ {
var endDirection:Float = (FlxG.width * 0.74) + endingOffset; var endDirection:Float = (FlxG.width * 0.74) + endingOffset;