5 min read | January 24, 2025
After 8 long months since 5.8.0, I'm happy to announce the largest Flixel release since I've taken over as lead. We don't like to go that far without releases, but new things just kept piling on. To name a few, we have:
FlxG.assets
, for customization to Flixel's asset management (hot-reloading!).The next release will be version 6.0.0, unless for some reason an urgent patch is needed for 5.9.0. For the current list of changes in Flixel 6, look here. Many devs are using 6.0.0 already, and you can too! Just run:
haxelib git flixel https://github.com/HaxeFlixel/flixel.git release6
If you have been compiling with no-deprecation-warnings
in your project's build command, now is the time to fix all of those, otherwise your project will not compile in Flixel 6. I also recommend using a haxe version of 4.3 or higher, which allows Flixel to suppress various internal deprecation warnings that were left in for backwards compatibility. If you have any issues with any of this don't hesitate to let me know, either in github or the Haxe discord's Flixel channel.
Special thanks to Starmapo for completely redoing FlxInputText
from the ground up! New features include:
selectionBeginIndex
and selectionEndIndex
variables added so you can get the span of the current selection.selectionColor
and selectedTextColor
variables can be changed to set the selection background and the selected text's color respectively. The custom format for the selected text can be disabled with useSelectedTextFormat
.setSelection()
and replace the currently selected text with replaceSelectedText()
.multiline
variable to dictate whether new lines can be created by the user.scrollH
and scrollV
variables. bottomScrollV
, maxScrollH
and maxScrollV
have also been added as helper read-only variables.mouseWheelEnabled
dictates whether or not the text field can be scrolled with the mouse wheel, by default set to true.background
variable can now be changed to toggle the background on/off.selectable
and editable
variables to dictate whether the text field can be selected/edited.forceCase
, filterMode
and the callback's action types.
Check out these features in the new FlxInputText Demo
With the addition of InputTextFrontEnd
, which controls the text input events used to power FlxInputText
, creating other text inputs will be much easier, expect a FlxBitmapInputText
, soon!
If you're sick of doing sprite.loadGraphic(Paths.image("hero"))
, well, you're in luck! FlxG.assets, is the new customizable interface that takes string asset paths and gives the desired assets. by setting the following dynamic method:
public dynamic function getAssetUnsafe(id:String, type:FlxAssetType, useCache = true):Null<Any>
HX
Here are just a few neat uses for this:
The above example that loads the hero sprite can be simplified to sprite.loadGraphic("hero")
, like so:
// Edit the simplified id before passing it to the old method
function path(id:String, type:FlxAssetType)
{
// for flixel assets, just pass them to the old method
if (StringTools.startsWith(id, "flixel/") || StringTools.contains(id, ':'))
return id;
return switch type
{
case BINARY: 'assets/data/$id'; // expects extension already'
case TEXT : 'assets/data/$id.json';
case IMAGE : 'assets/images/$id.png';
case SOUND : 'assets/sounds/$id.ogg';
case FONT : 'assets/font/$id.ttf';
};
}
final assets = FlxG.assets;
// Save the old methods, call them with the full path
final oldExists = assets.exists;
assets.exists = (id, ?type)->oldExists(path(id, type ?? BINARY), type);
final oldIsLocal = assets.isLocal;
assets.isLocal = (id, ?type, cache = true)->oldIsLocal(path(id, type ?? BINARY), type, cache);
final oldGet = assets.getAssetUnsafe;
assets.getAssetUnsafe = (id, type, cache = true)->oldGet(path(id, type), type, cache);
HX
Sick of building the game just to see some asset change in the game? Simply add the following flag to your build command, and the compiled game will look at the source assets whenever it's run:
-DFLX_CUSTOM_ASSETS_DIRECTORY="assets"
Not only will this save time on dev builds in projects with many assets, but you can modify assets and see them in your game without recompiling.
Define flag -DFLX_DEFAULT_SOUND_EXT="ogg"
to allow sound asset ids to omit the extension. Useful when targeting multiple platforms that use different sound files. Can also use the flag to determine the desired sound extension, setting the flags value to "mp3" "wav" or "ogg" will use that extension. The default extension can be read via FlxG.assets.defaultSoundExtension
Plenty of improvements, features and helpers have been added. Let's go over a few
overlapsObject
method in FlxTile, can be extended or set to allow custom overlap detection for tiles whose hit shape is smaller than the tileGridonCollide
signal, dispatched when overlaps are checked for collision reasonsgetMapIndex
, getRow
, getColumn
, getTileIndex
, getTileData
, tileExists
, setTileIndex
, getColumnAt
, getRowAt
, columnExists
, rowExists
, getColumnPos
, getRowPos
, getColumnPosAt
, getRowPosAt
, getTilePos
, getTilePosAt
, getAllTilePos
, forEachMapIndex
, getMapIndexAt
, tileExistsAt
, columnExistsAt
, rowExistsAt
, getTileIndexAt
, getTileDataAt
and setTileIndexAt
forEachOverlappingTile
method in FlxTilemap, to retrieve every tile that is overlapping the given objectisOverlappingTile
method, allows you to check all tiles overlapping an objectobjectOverlapsTiles
to replace the now deprecated overlapsWithCallbacks
flipCallbackParams
arg, allowing better typing of both callback paramsisCollision
flag to control whether the Tiles' collision callbacks are fired and allows for processing non-solid tilesFlxTypedTilemap<T:FlxTile>
for easier extension, with custom tile typesWe also broke apart Flixel's collision tools into smaller parts that can be used to customize the collision of any FlxObject.
FlxSave
: Allow custom handling of parsing errors (#3286)acceptMode
and "mapped inputs" (#3276) (#3280)
ACCEPT
and CANCEL
input IDs that conditionally map to either A
or B
depending on FlxG.gamepads.acceptMode
gamepad.getMappedInput
to get an enum value of every possible gamepad input from various devices, i.e. PS4(PS4ID.X)
FlxStrip
: Add support for blendmodes (#3213)FlxBasePath
: A simpler FlxPath without all the BS(#3153)For more updates, follow HaxeFlixel on BlueSky or check us out on Github and Discord!