HaxeFlixel Tutorial– Getting Started With Visual Studio Code

 

There is no requirement to use Visual Studio Code when developing in Haxe, it is however the editor I will be using for this series.  If you would prefer to use HaxeDevelop, be sure to check this earlier tutorial on how to get up and running.  There are several other editor options available with varying levels of Haxe language support.

 

First things first, we need to install Visual Studio Code, you can download it here.

image

 

The install process is pretty straight forward, run the installer and chose the defaults and you should be fine.  Once installed run Visual Studio Code.

 

Now we need to add Haxe language support.  Click the extensions tab, filter on “haxe” and click the install button for “Haxe — Haxe language support”.

image

 

Once installed it will prompt you to reload Visual Studio Code.  Do so.

image

 

If you haven’t already, create a project.  Instructions for doing so are available here.  Projects are folder based in Visual Studio Code.  To load your project either switch to the project directory from the commandline and type “code .” or load Visual Studio Code and select File->Open Folder.

image

 

Now you can run your game using Ctrl (Or Cmd) + Shift + P to bring up the command palette.  Now enter run task, like so:

image

 

Next pick the target platform you want to build for:

image

 

And TADA, your running application, assuming everything worked right:

image

 

If an error occurred, it will be show in the Problems panel:

image

 

Granted this process is a bit of a pain in the backside.  Thankfully there is a short cut for building and running the default build.  Simply hit Ctrl + Shift + B and it will compile for the default platform.  So… what is the default platform?  That would be Flash.  This of course means you have to have a Flash player installed.  Thankfully you can download one here.

 

What do you do if you want to change the default platform?  It’s a simple enough task, simply locate the file tasks.json in the .vscode folder.  Next locate the line “isBuildCommand”:true, and make sure this is copied to the entry you want to be the default build.  Like Highlanders, there can be only one, so be sure to erase it from the default “flash debug” task.

image

 

The Video

Programming HaxeFlixel


Scroll to Top