- Special Thanks to Ne_Eo for the new import function!
- Special Thanks to Juno for the What Engine logo!
-
mods/Your Mod/states/AchievementsMenuAddons.hx
-
mods/Your Mod/states/CreditsAddons.hx
-
mods/Your Mod/states/CustomBeatAddons.hx
-
mods/Your Mod/states/FreeplayAddons.hx
-
mods/Your Mod/states/MainMenuAddons.hx
-
mods/Your Mod/states/options.NoteOffsetAddons.hx
-
mods/Your Mod/states/options.OptionsAddons.hx
-
mods/Your Mod/states/PlayAddons.hx
-
mods/Your Mod/states/StoryMenuAddons.hx
-
mods/Your Mod/states/TitleAddons.hx
-
mods/Your Mod/states/ErrorState.hx
-
mods/Your Mod/states/FirstState.hx
- mods/Your Mod/states/AnyNameYouWant.hx
import("CustomBeatState");
var mus:MusicBeatState = new CustomBeatState("AnyNameYouWant");
if(mus!=null){
MusicBeatState.switchState(mus);
}
- mods/Your Mod/states/FreeplayAddons.hx
import("flixel.addons.transition.FlxTransitionableState");
//If you see red flash on screen something went wrong
funk.makeLuaSprite('NewBG', '', -FlxG.width*0.2, -FlxG.height*0.2);
funk.makeGraphic('NewBG', 2,2,'0xFFFB0F0B');
funk.scaleObject("NewBG", FlxG.width, FlxG.height);
funk.addLuaSprite("NewBG", true);
import("MusicBeatState");
import("LoadingState");
import("CustomBeatState");
var mus:MusicBeatState = new CustomBeatState("MyCustomState");
if(mus!=null){
import("CustomFadeTransition");
FlxTransitionableState.skipNextTransIn = true;
LoadingState.loadAndSwitchState(mus);
}
- mods/Your Mod/states/MyCustomState.hx
import("flixel.addons.transition.FlxTransitionableState");
import("MainMenuState");
GameStages.set("update",{func:function()
{
if(FlxG.keys.justPressed.R){
var mus:MusicBeatState = new CustomBeatState("MyCustomState");
if(mus!=null){
MusicBeatState.switchState(mus);
}
}
if (controls.BACK)
{
selectedSomethin = true;
FlxG.sound.play(Paths.sound('cancelMenu'));
MusicBeatState.switchState(new MainMenuState());
}
}});
GameStages.set("createPost",{func:function()
{
//IMPORTANT, cameras are not set by default:
game.cameras = FlxG.cameras;
}});
//Make the Yellow Background:
funk.makeLuaSprite('NewBG', '', -FlxG.width*0.2, -FlxG.height*0.2);
funk.makeGraphic('NewBG', 2,2,'0xFFF0FF0B');
funk.scaleObject("NewBG", FlxG.width, FlxG.height);
funk.addLuaSprite("NewBG", true);
//Make the text
var categoryText = new FlxText(775, 25, 0, "Custom Menu!", 32);
categoryText.setFormat(Paths.font("vcr.ttf"), 64, 0xFF000000, FlxAxes.CENTER, FlxTextBorderStyle.OUTLINE, 0xFFFFFFFF);
categoryText.screenCenter(FlxAxes.XY);
game.add(categoryText);
The funk variable is a class instance that attempts to cover some of the functions you may be used to seeing in lua, but make them all accessible to hscript. They work almost identically.
Example:
lua:
makeLuaSprite('bgOverlay','curveThing', -100, -200)
hscript:
funk.makeLuaSprite('bgOverlay','curveThing', -100, -200);
The game variable is the instance of the current menu you are on. So to add a sprite or text to the screen you may use game.add() and Reflect functions can be used on the game object as well.
Hscript-related errors are silently printed in the console for now, an upcoming update will allow window pop ups for quicker access to error logs.