Ads keep us online. Without them, we wouldn't exist. We don't have paywalls or sell mods - we never will. But every month we have large bills and running ads is our only way to cover them. Please consider unblocking us. Thank you from GameBanana <3

video intro before title screen (psych engine) - A Tutorial for Friday Night Funkin'.

how to make an epic video intro

NOTE: THIS IS ONLY TESTED FOR PSYCH ENGINE 0.7.2, IF ANYTHING DOES NOT WORK IN OLDER VERSIONS, YOU MIGHT HAVE TO CHECK PlayState.hx, AND BASIC HAXE KNOWLEDGE IS NEEDED!

So you have run through Gamebanana, asking for help in the Psych Ward discord server... but still no clue on how to play a video before the title screen like Vs Impostor? Well this is the right place to be!

Requirements

You will need:
  • A 64 bit PC
  • A coding software
  • Psych Engine Source Code
  • All the libraries and components needed

The Video File

Before actually coding the base, you of course must have a video first! Whip up a video and put it inside assets/videos, also make sure in Project.xml you have VIDEOS_ALLOWED uncommented!

The Classes

Open up TitleState.hx, located in your source/states, and now we will have to insert some classes. These classes will be defined for later VideoHandler. Put the classes anywhere except below typedef TitleData =.
#if VIDEOS_ALLOWED
#if (hxCodec >= "3.0.0") import hxcodec.flixel.FlxVideo as VideoHandler;
#elseif (hxCodec >= "2.6.1") import hxcodec.VideoHandler as VideoHandler;
#elseif (hxCodec == "2.6.0") import VideoHandler;
#else import vlc.MP4Handler as VideoHandler; #end #end

The Function

Now for the main part, we are going to create the startVideo function. Below the skipIntro function, paste in this piece of code.
public function startVideo(name:String)
    {
        #if VIDEOS_ALLOWED
        var filepath:String = Paths.video(name);
        #if sys
        if(!FileSystem.exists(filepath))
        #else
        if(!OpenFlAssets.exists(filepath))
        #end
        {
            FlxG.log.warn('Couldnt find video file: ' + name);
            startIntro();
            initialized = true;
            return;
        }
        var video:VideoHandler = new VideoHandler();
            #if (hxCodec >= "3.0.0")
            // Recent versions
            video.play(filepath);
            video.on End Reached.add(function() // REMOVE THE SPACE BETWEEN on, Reached AND End!!!!!!
            {
                video.dispose();
                startIntro();
                initialized = true;
                return;
            }, true);
            #else
            // Older versions
            video.playVideo(filepath);
            video.finishCallback = function()
            {
                startIntro();
                initialized = true;
                return;
            }
            #end
        #else
        FlxG.log.warn('Platform not supported!');
        return;
        #end
    }
Let me do some explanation on how this works. So first off, we have our #if VIDEOS_ALLOWED, this is to check if you have videos enabled and your platform can support this. Then we have the filepath, self explanatory. It will check if the file exists, if not it will warn you in the terminal that it's not working. If the file exists, it will play it, then when it reaches the end, it will run the startIntro function and change the initialized bool into true.

Running the video

The final step! So on line 164-172, remove the code and paste this code, then rename 'yourvideo' to the video name you have!
if (initialized)
            startIntro();
            else
            {
                new FlxTimer().start(1, function(tmr:FlxTimer)
                {
                    startVideo('innerslothIntro');
                    trace('starting video...');
                });
            }
Now just run lime test windows and boom! you have successfully finished your video intro!
If you have any questions, please comment down!
Login or Sign up to access this!
Login or Sign up to access this!

Comments

No comments yet!

Embed

Share banner
Image URL
HTML embed code
BB embed code
Markdown embed code

Credits

guy who wrote this
NotMagniill uPic
psych engine devs
Shadow Mario uPic
riveren uPic

Author

NotMagniill uPicCreator
Login or Sign up to access this!
Login or Sign up to access this!
Login or Sign up to access this!

Game

Login or Sign up to access this!

Category

Sub-category
Coding
Super-category
Modding iconModding

Tags

Details

Difficulty Level
Intermediate

Share

  • 10
  • 12k
  • 27
Login or Sign up to access this!
arrow_back