diff --git a/assets/videos/haxe.mp4 b/assets/videos/haxe.mp4 new file mode 100644 index 00000000000..006f524c45b Binary files /dev/null and b/assets/videos/haxe.mp4 differ diff --git a/source/StartupState.hx b/source/StartupState.hx index 22a2da2b30a..752cf36f31b 100644 --- a/source/StartupState.hx +++ b/source/StartupState.hx @@ -46,80 +46,79 @@ class StartupState extends MusicBeatState FlxTween.tween(skipTxt, {alpha: 1}, 1); new FlxTimer().start(0.1, function(tmr:FlxTimer) { - switch (theIntro) { - case 0: - FlxG.sound.play(Paths.sound('startup', 'splash')); - logo.scale.set(0.1,0.1); - logo.updateHitbox(); - logo.screenCenter(); - FlxTween.tween(logo, {alpha: 1, "scale.x": 1, "scale.y": 1}, 0.95, {ease: FlxEase.expoOut, onComplete: _ -> onIntroDone()}); - case 1: - FlxG.sound.play(Paths.sound('startup', 'splash')); - FlxG.sound.play(Paths.sound('FIREINTHEHOLE', 'splash')); - logo.loadGraphic(Paths.image('lobotomy', 'splash')); - logo.scale.set(0.1,0.1); - logo.updateHitbox(); - logo.screenCenter(); - FlxTween.tween(logo, {alpha: 1, "scale.x": 1, "scale.y": 1}, 1.35, {ease: FlxEase.expoOut, onComplete: _ -> onIntroDone()}); - case 2: - FlxG.sound.play(Paths.sound('screwedEngine', 'splash')); - logo.loadGraphic(Paths.image('ScrewedLogo', 'splash')); - logo.scale.set(0.1,0.1); - logo.updateHitbox(); - logo.screenCenter(); - FlxTween.tween(logo, {alpha: 1, "scale.x": 1, "scale.y": 1}, 1.35, {ease: FlxEase.expoOut, onComplete: _ -> onIntroDone(0.6)}); - case 3: - // secret muaahahhahhahaahha - FlxG.sound.play(Paths.sound('tada', 'splash')); - logo.loadGraphic(Paths.image('JavaScriptLogo', 'splash')); - logo.scale.set(0.1,0.1); - logo.updateHitbox(); - logo.screenCenter(); - FlxTween.tween(logo, {alpha: 1, "scale.x": 1, "scale.y": 1}, 1.35, {ease: FlxEase.expoOut, onComplete: _ -> onIntroDone(0.6)}); - case 4: - #if VIDEOS_ALLOWED - var vidSprite = new MP4Handler(); // it plays but it doesn't show??? - #if (hxCodec < "3.0.0") - vidSprite.playVideo(Paths.video('bambiStartup'), false, false); - vidSprite.finishCallback = function() - { - try { vidSprite.dispose(); } - catch (e) {} - FlxG.switchState(TitleState.new); - }; - #else - vidSprite.play(Paths.video('bambiStartup')); - vidSprite.onEndReached.add(function(){ - vidSprite.dispose(); - FlxG.switchState(TitleState.new); - }); - #end - #end - case 5: - #if VIDEOS_ALLOWED - var vidSprite = new MP4Handler(); // it plays but it doesn't show??? - #if (hxCodec < "3.0.0") - vidSprite.playVideo(Paths.video('broCopiedDenpa'), false, false); - vidSprite.finishCallback = function() - { - try { vidSprite.dispose(); } - catch (e) {} - FlxG.switchState(TitleState.new); - }; - #else - vidSprite.play(Paths.video('broCopiedDenpa')); - vidSprite.onEndReached.add(function(){ - vidSprite.dispose(); - FlxG.switchState(TitleState.new); - }); - #end - #end + if (!FlxG.random.bool(0.1)){ + switch (theIntro) { + case 0: + FlxG.sound.play(Paths.sound('startup', 'splash')); + logo.scale.set(0.1,0.1); + logo.updateHitbox(); + logo.screenCenter(); + FlxTween.tween(logo, {alpha: 1, "scale.x": 1, "scale.y": 1}, 0.95, {ease: FlxEase.expoOut, onComplete: _ -> onIntroDone()}); + case 1: + FlxG.sound.play(Paths.sound('startup', 'splash')); + FlxG.sound.play(Paths.sound('FIREINTHEHOLE', 'splash')); + logo.loadGraphic(Paths.image('lobotomy', 'splash')); + logo.scale.set(0.1,0.1); + logo.updateHitbox(); + logo.screenCenter(); + FlxTween.tween(logo, {alpha: 1, "scale.x": 1, "scale.y": 1}, 1.35, {ease: FlxEase.expoOut, onComplete: _ -> onIntroDone()}); + case 2: + FlxG.sound.play(Paths.sound('screwedEngine', 'splash')); + logo.loadGraphic(Paths.image('ScrewedLogo', 'splash')); + logo.scale.set(0.1,0.1); + logo.updateHitbox(); + logo.screenCenter(); + FlxTween.tween(logo, {alpha: 1, "scale.x": 1, "scale.y": 1}, 1.35, {ease: FlxEase.expoOut, onComplete: _ -> onIntroDone(0.6)}); + case 3: + // secret muaahahhahhahaahha + FlxG.sound.play(Paths.sound('tada', 'splash')); + logo.loadGraphic(Paths.image('JavaScriptLogo', 'splash')); + logo.scale.set(0.1,0.1); + logo.updateHitbox(); + logo.screenCenter(); + FlxTween.tween(logo, {alpha: 1, "scale.x": 1, "scale.y": 1}, 1.35, {ease: FlxEase.expoOut, onComplete: _ -> onIntroDone(0.6)}); + case 4: + playVideo('bambiStartup'); + case 5: + playVideo('broCopiedDenpa'); + } } + else + playVideo('haxe'); // Lily wanted this }); super.create(); } + // shorter & cleaner code = better :3 + private function playVideo(name:String, ?callback:Void->Void):Void + { + #if VIDEOS_ALLOWED + var vidSprite = new MP4Handler(); // it plays but it doesn't show??? + #if (hxCodec < "3.0.0") + vidSprite.playVideo(Paths.video(name), false, false); + vidSprite.finishCallback = function() + { + try { vidSprite.dispose(); } + catch (e) {} + if (callback != null) + callback(); + else + FlxG.switchState(TitleState.new); + }; + #else + vidSprite.play(Paths.video(name)); + vidSprite.onEndReached.add(function(){ + vidSprite.dispose(); + if (callback != null) + callback(); + else + FlxG.switchState(TitleState.new); + }); + #end + #end + } + function onIntroDone(?fadeDelay:Float = 0) { FlxTween.tween(logo, {alpha: 0}, 1, { startDelay: fadeDelay,