Skip to content

Custom Loading Screen

ShadowMario edited this page Feb 11, 2025 · 2 revisions

Note: These instructions are exclusively to downloaded builds, as it only works in the Mod Folder of the current loaded Mod.

The Loading Screen file is very simplistic compared to a PlayState script, and supports only HScript due to Lua taking too long to initialize.


Setup

Go to mods/My-Mod/data/ and create a LoadingScreen.hx file, every song in your mod will now be using this Loading Screen script.

If you want to check for a specific song, you can use a switch case like this:

switch(Paths.formatToSongPath(PlayState.SONG.song))
{
    case 'darnell':
        //Will only load this part of the code in Darnell
    case 'lit-up':
        //Will only load this part of the code in Lit Up
    case '2hot':
        //Will only load this part of the code in 2Hot
    case 'blazin':
        //Will only load this part of the code in Blazin
}

Functions, Methods and Variables

Functions

onCreate() - Post super.create function, called once on Loading Screen start. onUpdate(elapsed:Float) - Post super.update function, called every frame.

Methods

getLoaded() - Get how many files have been successfully loaded or failed to load currently.
getLoadMax() - Get how many files it is supposed to load.
addBehindBar(obj:FlxBasic) - Inserts an instance behind the Progress Bar, recommended over add

Variables

intendedPercent - same as getLoaded() / getLoadMax(), ranges from 0 to 1.
curPercent - Progress bar's visual percentage, it slowly lerps to the intendedPercent value.
barGroup - A FlxSpriteGroup that contains barBackground and bar.
barBackground - Contained inside barGroup, it's the black background behind the moving progress bar.
bar - Contained inside barGroup, it's the white moving progress bar that scales accordingly to curPercent's value.
barWidth - How wide bar should be when curPercent equals to 1``
game.stateChangeDelay - Makes the Loading Screen take longer to finish, recommended for development purposes or a custom transition.


Examples

Base Game Recreation/Template - Move this as mods/My-Mod/data/LoadingScreen.hx
Dragon Ball Z: Budokai 3 - Loading Minigame - Saibamen spawn randomly on screen, mash WASD/Arrow keys to make them spawn faster, this also delays the loading screen by 10 seconds for testing purposes.

Clone this wiki locally