diff --git a/source/funkin/ui/title/AttractState.hx b/source/funkin/ui/title/AttractState.hx new file mode 100644 index 000000000..d630c07f2 --- /dev/null +++ b/source/funkin/ui/title/AttractState.hx @@ -0,0 +1,24 @@ +package funkin.ui.title; + +/** + * After about 2 minutes of inactivity on the title screen, + * the game will enter the Attract state, as a reference to physical arcade machines. + * + * In the current version, this just plays the Kickstarter trailer, but this can be changed to + * gameplay footage, a generic game trailer, or something more elaborate. + */ +class AttractState extends MusicBeatState +{ + static final ATTRACT_VIDEO_PATH:String = Paths.videos('kickstarterTrailer.mp4'); + + public override function create():Void {} + + /** + * When the attraction state ends (after the video ends or the user presses any button), + * switch immediately to the title screen. + */ + function onAttractEnd():Void + { + FlxG.switchState(new TitleState()); + } +} diff --git a/source/funkin/ui/title/TitleState.hx b/source/funkin/ui/title/TitleState.hx index 3cd060a37..d946f2a6e 100644 --- a/source/funkin/ui/title/TitleState.hx +++ b/source/funkin/ui/title/TitleState.hx @@ -192,8 +192,14 @@ class TitleState extends MusicBeatState else initialized = true; + if (FlxG.sound.music != null) FlxG.sound.music.onComplete = moveToAttract; } + /** + * After sitting on the title screen for a while, transition to the attract screen. + */ + function moveToAttact():Void {} + function playMenuMusic():Void { if (FlxG.sound.music == null || !FlxG.sound.music.playing)