From 3f1552be6e7da4b2ce987919d0deaa449c2927ed Mon Sep 17 00:00:00 2001 From: Cameron Taylor Date: Fri, 9 Apr 2021 20:34:25 -0400 Subject: [PATCH] tankman shit maybe --- source/PlayState.hx | 19 +++++++++++++++++-- source/TankCutscene.hx | 27 +++++++++++++++++++++++++++ source/TitleState.hx | 2 +- 3 files changed, 45 insertions(+), 3 deletions(-) create mode 100644 source/TankCutscene.hx diff --git a/source/PlayState.hx b/source/PlayState.hx index 5b1d6fb6d..22e3c5922 100644 --- a/source/PlayState.hx +++ b/source/PlayState.hx @@ -1023,6 +1023,17 @@ class PlayState extends MusicBeatState }); } + /** + * [ + * [0, function(){blah;}], + * [4.6, function(){blah;}], + * [25.1, function(){blah;}], + * [30.7, function(){blah;}] + * ] + * SOMETHING LIKE THIS + */ + // var cutsceneFunctions:Array = []; + function stressIntro() { // for story mode shit @@ -1049,11 +1060,12 @@ class PlayState extends MusicBeatState gfTankmen.antialiasing = true; gfCutsceneLayer.add(gfTankmen); - var tankCutscene:FlxSprite = new FlxSprite(-70, 320); + var tankCutscene:TankCutscene = new TankCutscene(-70, 320); tankCutscene.frames = Paths.getSparrowAtlas('cutsceneStuff/tankTalkSong3-pt1'); tankCutscene.animation.addByPrefix('tankyguy', 'TANK TALK 3 P1 UNCUT', 24, false); // tankCutscene.animation.addByPrefix('weed', 'sexAmbig', 24, false); tankCutscene.animation.play('tankyguy'); + tankCutscene.antialiasing = true; bfTankCutsceneLayer.add(tankCutscene); // add(); @@ -1142,7 +1154,10 @@ class PlayState extends MusicBeatState }); } - cutsceneSound.play(); + // new FlxTimer().start(0.01, function(tmr) cutsceneSound.play()); // cutsceneSound.play(); + // cutsceneSound.play(); + tankCutscene.startSyncAudio = cutsceneSound; + // tankCutscene.animation.curAnim.curFrame FlxG.camera.zoom = defaultCamZoom * 1.15; diff --git a/source/TankCutscene.hx b/source/TankCutscene.hx new file mode 100644 index 000000000..a8a18321c --- /dev/null +++ b/source/TankCutscene.hx @@ -0,0 +1,27 @@ +package; + +import flixel.FlxSprite; +import flixel.system.FlxSound; + +class TankCutscene extends FlxSprite +{ + public var startSyncAudio:FlxSound; + + public function new(x:Float, y:Float) + { + super(x, y); + } + + var startedPlayingSound:Bool = false; + + override function update(elapsed:Float) + { + if (animation.curAnim.curFrame >= 1 && !startedPlayingSound) + { + startSyncAudio.play(); + startedPlayingSound = true; + } + + super.update(elapsed); + } +} diff --git a/source/TitleState.hx b/source/TitleState.hx index 9f5bfd3bb..f138521c0 100644 --- a/source/TitleState.hx +++ b/source/TitleState.hx @@ -425,7 +425,7 @@ class TitleState extends MusicBeatState } #if web - if (!initialized && FlxG.keys.justPressed.ENTER) + if (!initialized && controls.ACCEPT) { netStream.dispose(); FlxG.stage.removeChild(video);