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 belowtypedef 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 thestartVideo
function. Below the skipIntro
function, paste in this piece of code.public function startVideo(name:String)Let me do some explanation on how this works. So first off, we have our
{
#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
}
#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)Now just run
startIntro();
else
{
new FlxTimer().start(1, function(tmr:FlxTimer)
{
startVideo('innerslothIntro');
trace('starting video...');
});
}
lime test windows
and boom! you have successfully finished your video intro!If you have any questions, please comment down!