1
0
Fork 0
mirror of https://github.com/ninjamuffin99/Funkin.git synced 2024-12-27 07:27:12 +00:00

Implement basic AttractState.

This commit is contained in:
EliteMasterEric 2023-08-08 15:41:48 -04:00
parent 3f99e0e3da
commit ec76c54ccd
2 changed files with 30 additions and 0 deletions

View file

@ -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());
}
}

View file

@ -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)