Skip to content

RichardBray/haxe-flixel-template

Repository files navigation

HaxeFlixel Game Template

Everything you need to quickly start making your HF game

No need to install Haxe, OpenFL, Lime or HaxeFlixel separately.
This template takes care of all of that with the power of Lix and Nodejs.


This template requires Node.js v16 or higher to be installed to run most of the commands below.

1. Download

You can also create a new project based on this template using degit which will ignore all .git related files.

npx degit RichardBray/haxe-flixel-template [my-flixel-game]
cd [my-flixel-game]

NOTE: Replace [my-flixel-game] with the name of your game.

2. Install dependencies

These steps only need to be applied the first time you download the template.

Then install package dependencies

cd [my-flixel-game]
npm i -g lix
npm i
npx lix download
npm run dev

3. Running the project

If you've applied the steps above before, this means you have lix installed globally.

All you need to do is

cd [my-flixel-game]
npm run dev

Navigate to port 1212 in your browser. http://localhost:1212/




How it works

The project heavily relies on a package called hf-scripts. This package contains the two main scripts that are used to run the project, startup and comp-server.

startup

This script is triggered on the npm start or npm run dev command and does a few things by default:

  • builds the game for HTML5
  • starts the watcher web and compilation server

Build for HTML5

This runs the command lix lime build HTML5 -debug and is connected to the compilation server if it is run in a different tab.

You can run your project without a compilation server by creating a file called config.json in the root of your project and using these settings:

{
  "useCompServer": false
}

The useCompServer setting is set to true by default. This will cache unchanging code making subsequent builds much faster.


The watcher and web server

Your .hx files are watched with Chokadir. Anytime you save a file it will trigger an automatic rebuild.

npm start

The web server runs the game in a given port. You can change the port in your config.json file with these settings:

{
  "webServerPort": 3000
}

Github actions

This template contains a github action file that will:

  • create a gh_pages branch
  • build the game for HTML5 to that branch tab

This action is commented out and would need to be uncommented to be enabled.

By default this will happen whenever code is merged to the main branch but this can be changed.

About

HaxeFlixel game starter powered by Lix and Node.js

Resources

License

Stars

Watchers

Forks

Sponsor this project

Packages

No packages published

Languages