mirror of
https://github.com/ninjamuffin99/Funkin.git
synced 2025-11-25 13:45:49 +00:00
readd IntroSubState from char unlock
This commit is contained in:
parent
bea23c37a8
commit
9f5c154b1d
|
|
@ -8,22 +8,24 @@ import hxcodec.flixel.FlxVideoSprite;
|
||||||
#end
|
#end
|
||||||
import funkin.ui.MusicBeatSubState;
|
import funkin.ui.MusicBeatSubState;
|
||||||
import funkin.audio.FunkinSound;
|
import funkin.audio.FunkinSound;
|
||||||
|
import funkin.save.Save;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* After about 2 minutes of inactivity on the title screen,
|
* When you first enter the character select state, it will play an introductory video opening up the lights
|
||||||
* the game will enter the Attract state, as a reference to physical arcade machines.
|
|
||||||
*
|
|
||||||
* In the current version, this just plays the ~~Kickstarter trailer~~ Erect teaser, but this can be changed to
|
|
||||||
* gameplay footage, a generic game trailer, or something more elaborate.
|
|
||||||
*/
|
*/
|
||||||
class IntroSubState extends MusicBeatSubState
|
class IntroSubState extends MusicBeatSubState
|
||||||
{
|
{
|
||||||
static final ATTRACT_VIDEO_PATH:String = Paths.stripLibrary(Paths.videos('introSelect'));
|
static final LIGHTS_VIDEO_PATH:String = Paths.stripLibrary(Paths.videos('introSelect'));
|
||||||
|
|
||||||
var introSound:FunkinSound = null;
|
var introSound:FunkinSound = null;
|
||||||
|
|
||||||
public override function create():Void
|
public override function create():Void
|
||||||
{
|
{
|
||||||
|
if (Save.instance.oldChar)
|
||||||
|
{
|
||||||
|
onLightsEnd();
|
||||||
|
return;
|
||||||
|
}
|
||||||
// Pause existing music.
|
// Pause existing music.
|
||||||
if (FlxG.sound.music != null)
|
if (FlxG.sound.music != null)
|
||||||
{
|
{
|
||||||
|
|
@ -32,15 +34,20 @@ class IntroSubState extends MusicBeatSubState
|
||||||
}
|
}
|
||||||
|
|
||||||
#if html5
|
#if html5
|
||||||
trace('Playing web video ${ATTRACT_VIDEO_PATH}');
|
trace('Playing web video ${LIGHTS_VIDEO_PATH}');
|
||||||
playVideoHTML5(ATTRACT_VIDEO_PATH);
|
playVideoHTML5(LIGHTS_VIDEO_PATH);
|
||||||
#end
|
#end
|
||||||
|
|
||||||
#if hxCodec
|
#if hxCodec
|
||||||
trace('Playing native video ${ATTRACT_VIDEO_PATH}');
|
trace('Playing native video ${LIGHTS_VIDEO_PATH}');
|
||||||
playVideoNative(ATTRACT_VIDEO_PATH);
|
playVideoNative(LIGHTS_VIDEO_PATH);
|
||||||
#end
|
#end
|
||||||
|
|
||||||
|
// Im TOO lazy to even care, so uh, yep
|
||||||
|
FlxG.camera.zoom = 0.66666666666666666666666666666667;
|
||||||
|
vid.x = -(FlxG.width - (FlxG.width * FlxG.camera.zoom));
|
||||||
|
vid.y = -((FlxG.height - (FlxG.height * FlxG.camera.zoom)) * 0.75);
|
||||||
|
|
||||||
introSound = new FunkinSound();
|
introSound = new FunkinSound();
|
||||||
introSound.loadEmbedded(Paths.sound('CS_Lights'));
|
introSound.loadEmbedded(Paths.sound('CS_Lights'));
|
||||||
introSound.pitch = 1;
|
introSound.pitch = 1;
|
||||||
|
|
@ -64,7 +71,7 @@ class IntroSubState extends MusicBeatSubState
|
||||||
{
|
{
|
||||||
vid.zIndex = 0;
|
vid.zIndex = 0;
|
||||||
|
|
||||||
vid.finishCallback = onAttractEnd;
|
vid.finishCallback = onLightsEnd;
|
||||||
|
|
||||||
add(vid);
|
add(vid);
|
||||||
}
|
}
|
||||||
|
|
@ -88,7 +95,7 @@ class IntroSubState extends MusicBeatSubState
|
||||||
if (vid != null)
|
if (vid != null)
|
||||||
{
|
{
|
||||||
vid.zIndex = 0;
|
vid.zIndex = 0;
|
||||||
vid.bitmap.onEndReached.add(onAttractEnd);
|
vid.bitmap.onEndReached.add(onLightsEnd);
|
||||||
|
|
||||||
add(vid);
|
add(vid);
|
||||||
vid.play(filePath, false);
|
vid.play(filePath, false);
|
||||||
|
|
@ -104,30 +111,33 @@ class IntroSubState extends MusicBeatSubState
|
||||||
{
|
{
|
||||||
super.update(elapsed);
|
super.update(elapsed);
|
||||||
|
|
||||||
if (controls.ACCEPT)
|
// if (!introSound.paused)
|
||||||
{
|
// {
|
||||||
onAttractEnd();
|
// #if html5
|
||||||
}
|
// @:privateAccess
|
||||||
|
// vid.netStream.seek(introSound.time);
|
||||||
|
// #elseif hxCodec
|
||||||
|
// vid.bitmap.time = Std.int(introSound.time);
|
||||||
|
// #end
|
||||||
|
// }
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* When the attraction state ends (after the video ends or the user presses any button),
|
* When the lights video finishes, it will close the substate
|
||||||
* switch immediately to the title screen.
|
|
||||||
*/
|
*/
|
||||||
function onAttractEnd():Void
|
function onLightsEnd():Void
|
||||||
{
|
{
|
||||||
#if (html5 || hxCodec)
|
|
||||||
if (vid != null)
|
if (vid != null)
|
||||||
{
|
{
|
||||||
#if hxCodec
|
#if hxCodec
|
||||||
vid.stop();
|
vid.stop();
|
||||||
#end
|
#end
|
||||||
remove(vid);
|
remove(vid);
|
||||||
|
|
||||||
vid.destroy();
|
vid.destroy();
|
||||||
vid = null;
|
vid = null;
|
||||||
}
|
}
|
||||||
#end
|
|
||||||
|
FlxG.camera.zoom = 1;
|
||||||
|
|
||||||
close();
|
close();
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue