mirror of
https://github.com/ninjamuffin99/Funkin.git
synced 2024-12-26 15:07:14 +00:00
Implement basic AttractState.
This commit is contained in:
parent
3f99e0e3da
commit
ec76c54ccd
24
source/funkin/ui/title/AttractState.hx
Normal file
24
source/funkin/ui/title/AttractState.hx
Normal 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());
|
||||
}
|
||||
}
|
|
@ -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)
|
||||
|
|
Loading…
Reference in a new issue