COMMUNITY

Haxe Godot externs - Updated for Godot 3.4

I’ve just released an update on my Haxe externs for the Godot game engine to support the 3.3.0 version.

I’ve also created an editor plugin which makes using Haxe with Godot simpler without the need to create files manually or manipulate C# files.

If you want to get started download Godot 3.3 Mono version, install the externs with haxelib install godot, then follow the plugin’s setup instructions, and you can now make a Godot game with Haxe :slight_smile:

A Haxe Godot project uses a normal hxml file, so you can easily use Haxe libraries by adding a

--library libname

The externs give you:

  • A familiar Haxe naming convention with camelCase for methods and variable, instead of C#'s PascalCase.
  • Type-safe signals allowing you to write
    mynode.onTheSignal.connect(myHandler.myFunction)
    
    instead of
    mynode.connect("the_signal", myHandler, "myFunction")
    
    making sure you aren’t typing the signal or function name wrong, or using a function with the wrong signature at compile time.
  • Auto-completion with documentation, api documentation

The externs are generated so you can expect timely updates to match new Godot releases.

If you want to see a demo there is an Haxe version of the squash the creeps 3d tutorial.

The externs, and especially the editor plugin, are still new, so if you find a bug please open an issue on github.
If you want to request a feature of discuss the project there is this topic and github discussions.

20 Likes

The externs have been updated for Godot 3.4 (api documentation) and are available on haxelib.

(EDIT: there was a small issue and I released a patched version 3.4.1 on haxelib)

The release also include improved type safety for signals and actions, better interoperability for arrays, the editor classes and @:tool metadata. With scripts no longer requiring to be attached to a node to be compiled.

The @:onready metadata allows you, similarly to gdscript’s onready, to delay a variable initialization until the node is ready.

@:onready var myNode = getNode("Path/To/Node).as(Spatial);

If you have a bug open an issue on github and for other questions use the github discussions.

7 Likes