11package states ;
22import states .stages .objects .* ;
3+ import objects .VideoSprite ;
34
45// About time i got around to this
56class SplashScreen extends MusicBeatState
@@ -27,6 +28,7 @@ class SplashScreen extends MusicBeatState
2728 var splashGlowParticles : FlxTypedGroup <SplashGlowParticle >;
2829 var initX : Float ;
2930
31+ public var videoCutscene : VideoSprite = null ;
3032 override public function create ()
3133 {
3234 // var currentDate = ExtendedDate.global();
@@ -111,6 +113,47 @@ class SplashScreen extends MusicBeatState
111113 super .create ();
112114 }
113115
116+ public function startVideo (name : String , forMidSong : Bool = false , canSkip : Bool = true , loop : Bool = false , playOnLoad : Bool = true )
117+ {
118+ #if VIDEOS_ALLOWED
119+ var foundFile : Bool = false ;
120+ var fileName : String = Paths .video (name );
121+
122+ #if sys
123+ if (FileSystem .exists (fileName ))
124+ #else
125+ if (OpenFlAssets .exists (fileName ))
126+ #end
127+ foundFile = true ;
128+
129+ if (foundFile )
130+ {
131+ videoCutscene = new VideoSprite (fileName , forMidSong , canSkip , loop );
132+
133+ // Finish callback
134+ function onVideoEnd ()
135+ {
136+ videoCutscene = null ;
137+ Conductor .songPosition = 0 ;
138+ TransitionState .transitionState (TitleState , {duration : 1.5 , transitionType : " stickers" , color : FlxColor .BLACK });
139+ }
140+ videoCutscene .finishCallback = onVideoEnd ;
141+ videoCutscene .onSkip = onVideoEnd ;
142+ add (videoCutscene );
143+
144+ if (playOnLoad )
145+ videoCutscene .play ();
146+ return videoCutscene ;
147+ }
148+ else FlxG .log .error (" Video not found: " + fileName );
149+ #else
150+ FlxG .log .warn (' Platform not supported!' );
151+ Conductor .songPosition = 0 ;
152+ TransitionState .transitionState (TitleState , {duration : 1.5 , transitionType : " stickers" , color : FlxColor .BLACK });
153+ #end
154+ return null ;
155+ }
156+
114157 function particleBoom () {
115158 splashGrad .alpha = 1 ;
116159 var particlesNum : Int = FlxG .random .int (8 , 12 );
@@ -130,44 +173,46 @@ class SplashScreen extends MusicBeatState
130173 override function stepHit ()
131174 {
132175 super .stepHit ();
133- switch (curStep )
134- {
135- case 3 :
136- tape .alpha = 1 ;
137- tapeT = FlxTween .tween (tape , {x :initX + 235 , y :mixtapeEngine .y }, Conductor .stepCrochet * 0.001 * 4 , {ease : FlxEase .expoInOut });
138- tapeTA = FlxTween .tween (tape , {alpha : 0 }, Conductor .stepCrochet * 0.001 * 4 , {ease : FlxEase .expoInOut });
139- case 6 :
140- particleBoom ();
141- engine .alpha = 1 ;
142- engineT = FlxTween .tween (engine , {x :tape .x + 305 , y :mixtapeEngine .y }, Conductor .stepCrochet * 0.001 * 4 , {ease : FlxEase .expoInOut });
143- engineTA = FlxTween .tween (engine , {alpha : 0 }, Conductor .stepCrochet * 0.001 * 4 , {ease : FlxEase .expoInOut });
144- case 9 :
145- FlxG .camera .zoom = 3 ;
146- FlxG .camera .scrollAngle = (360 * 2 );
147- case 10 :
148- mixtapeLogo .alpha = 1 ;
149- camTween = FlxTween .tween (FlxG .camera , {zoom : 1 , scrollAngle : 0 }, Conductor .stepCrochet * 0.001 * 2 , {ease : FlxEase .sineInOut });
150- case 12 :
151- mix .alpha = 1 ;
152- tape .alpha = 1 ;
153- FlxG .camera .zoom = 1.2 ;
154- FlxG .camera .scrollAngle = 15 ;
155- camTween = FlxTween .tween (FlxG .camera , {zoom : 1 , scrollAngle : 0 }, Conductor .stepCrochet * 0.001 * 1 , {ease : FlxEase .sineInOut });
156- mixTA = FlxTween .tween (mix , {alpha : 0 }, Conductor .stepCrochet * 0.001 * 3 , {ease : FlxEase .expoInOut });
157- tapeTA = FlxTween .tween (tape , {alpha : 0 }, Conductor .stepCrochet * 0.001 * 3 , {ease : FlxEase .expoInOut });
158- case 14 :
159- FlxG .camera .zoom = 1.2 ;
160- FlxG .camera .scrollAngle = - 15 ;
161- camTween = FlxTween .tween (FlxG .camera , {zoom : 1 , scrollAngle : 0 }, Conductor .stepCrochet * 0.001 * 1 , {ease : FlxEase .sineInOut });
162- engine .alpha = 1 ;
163- engineTA = FlxTween .tween (engine , {alpha : 0 }, Conductor .stepCrochet * 0.001 * 3 , {ease : FlxEase .expoInOut });
164- case 16 :
165- FlxG .camera .zoom = 1.5 ;
166- camTween = FlxTween .tween (FlxG .camera , {zoom : 1 }, Conductor .stepCrochet * 0.001 * 8 , {ease : FlxEase .sineInOut });
167- particleBoom ();
168- mixtapeEngine .alpha = 1 ;
169- FlxTween .tween (mixtapeEngine , {alpha : 0 }, Conductor .stepCrochet * 0.001 * 8 , {ease : FlxEase .expoInOut });
170- FlxTween .tween (mixtapeLogo , {alpha : 0 }, Conductor .stepCrochet * 0.001 * 8 , {ease : FlxEase .expoInOut });
176+ if (! videoPlaying ) {
177+ switch (curStep )
178+ {
179+ case 3 :
180+ tape .alpha = 1 ;
181+ tapeT = FlxTween .tween (tape , {x :initX + 235 , y :mixtapeEngine .y }, Conductor .stepCrochet * 0.001 * 4 , {ease : FlxEase .expoInOut });
182+ tapeTA = FlxTween .tween (tape , {alpha : 0 }, Conductor .stepCrochet * 0.001 * 4 , {ease : FlxEase .expoInOut });
183+ case 6 :
184+ particleBoom ();
185+ engine .alpha = 1 ;
186+ engineT = FlxTween .tween (engine , {x :tape .x + 305 , y :mixtapeEngine .y }, Conductor .stepCrochet * 0.001 * 4 , {ease : FlxEase .expoInOut });
187+ engineTA = FlxTween .tween (engine , {alpha : 0 }, Conductor .stepCrochet * 0.001 * 4 , {ease : FlxEase .expoInOut });
188+ case 9 :
189+ FlxG .camera .zoom = 3 ;
190+ FlxG .camera .scrollAngle = (360 * 2 );
191+ case 10 :
192+ mixtapeLogo .alpha = 1 ;
193+ camTween = FlxTween .tween (FlxG .camera , {zoom : 1 , scrollAngle : 0 }, Conductor .stepCrochet * 0.001 * 2 , {ease : FlxEase .sineInOut });
194+ case 12 :
195+ mix .alpha = 1 ;
196+ tape .alpha = 1 ;
197+ FlxG .camera .zoom = 1.2 ;
198+ FlxG .camera .scrollAngle = 15 ;
199+ camTween = FlxTween .tween (FlxG .camera , {zoom : 1 , scrollAngle : 0 }, Conductor .stepCrochet * 0.001 * 1 , {ease : FlxEase .sineInOut });
200+ mixTA = FlxTween .tween (mix , {alpha : 0 }, Conductor .stepCrochet * 0.001 * 3 , {ease : FlxEase .expoInOut });
201+ tapeTA = FlxTween .tween (tape , {alpha : 0 }, Conductor .stepCrochet * 0.001 * 3 , {ease : FlxEase .expoInOut });
202+ case 14 :
203+ FlxG .camera .zoom = 1.2 ;
204+ FlxG .camera .scrollAngle = - 15 ;
205+ camTween = FlxTween .tween (FlxG .camera , {zoom : 1 , scrollAngle : 0 }, Conductor .stepCrochet * 0.001 * 1 , {ease : FlxEase .sineInOut });
206+ engine .alpha = 1 ;
207+ engineTA = FlxTween .tween (engine , {alpha : 0 }, Conductor .stepCrochet * 0.001 * 3 , {ease : FlxEase .expoInOut });
208+ case 16 :
209+ FlxG .camera .zoom = 1.5 ;
210+ camTween = FlxTween .tween (FlxG .camera , {zoom : 1 }, Conductor .stepCrochet * 0.001 * 8 , {ease : FlxEase .sineInOut });
211+ particleBoom ();
212+ mixtapeEngine .alpha = 1 ;
213+ FlxTween .tween (mixtapeEngine , {alpha : 0 }, Conductor .stepCrochet * 0.001 * 8 , {ease : FlxEase .expoInOut });
214+ FlxTween .tween (mixtapeLogo , {alpha : 0 }, Conductor .stepCrochet * 0.001 * 8 , {ease : FlxEase .expoInOut });
215+ }
171216 }
172217 }
173218
0 commit comments