Search icon CANCEL
Subscription
0
Cart icon
Your Cart (0 item)
Close icon
You have no products in your basket yet
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Free Learning
Arrow right icon
Arrow up icon
GO TO TOP
Haxe Game Development Essentials

You're reading from   Haxe Game Development Essentials Create games on multiple platforms from a single codebase using Haxe and the HaxeFlixel engine

Arrow left icon
Product type Paperback
Published in Nov 2015
Publisher
ISBN-13 9781785289781
Length 188 pages
Edition 1st Edition
Concepts
Arrow right icon
Toc

Table of Contents (10) Chapters Close

Preface 1. Getting Started FREE CHAPTER 2. Building a New Game 3. Dealing with Menus and Screen Flow 4. Delving into Animations and Gameplay 5. Adding Sound 6. Working with Configuration Files 7. Deploying to Multiple Platforms 8. What's Next? Index

Installation

Now that you have a good understanding of what we'll be using, let's start installing what we'll need. Haxe, OpenFL, and HaxeFlixel are all designed to be easy to set up, so this is going to be pretty straightforward.

Installing Haxe

Go to http://haxe.org/download/ and download the installer for your operating system. Run the installer; be sure to install both Haxe and Neko when given the option.

This will install the Haxe framework, which includes Haxelib, a useful tool for installing Haxe frameworks and libraries. You will typically use this to install all Haxe libraries, which will make the installation of OpenFL and HaxeFlixel incredibly straightforward.

OpenFL

To install OpenFL, open a command window (or terminal on OS X and Linux). Next, run the following commands:

haxelib install openfl
haxelib -notimeout run openfl setup

These two commands will download, install, and set up the OpenFL framework and all of the libraries it needs. The notimeout flag prevents the setup from timing out before it completes. This is useful because the OpenFL setup will download quite a number of files, and it can time out if your internet connection is a little slow.

When asked if you want to install OpenFL, press Y. On Mac and Linux, you may be asked to enter your password. After this, OpenFL will be installed and you'll be good to go!

Setting up an IDE

Before installing HaxeFlixel, it's important to install a code-editing tool, because you will be prompted to choose one during the HaxeFlixel setup. Your operating system will be a factor in choosing the best tool for you.

Windows users are able to use FlashDevelop, which is a fully featured IDE that will work with Haxe out of the box. The best part of using FlashDevelop is that you can debug your games by targeting Flash and using the Flash debug player. This will allow you to put in breakpoints, see console logs, and inspect variables. You can download the latest version by going to http://flashdevelop.org. If you are using Windows, I highly recommend using it.

For Mac and Linux users, the best tool available is Sublime Text 2. It's a solid code-editing tool, though it lacks support for breakpoints, console logs, and variable inspection. You can download the latest version by going to http://sublimetext.com. You can also use Sublime Text on Windows if you prefer it.

To make Sublime Text a more effective Haxe editing tool, you should install the Haxe plugin. The easiest way to install it is using package control, which you can install using the steps located at https://packagecontrol.io/installation#st2.

After installing package control, use Ctrl + Shift + P (Windows or Linux) or cmd + Shift + P (Mac) to bring up the command palette. Start typing in package and then navigate down to Install Package. You will then see a list of available packages to install. Type in Haxe to find the package named Haxe. Install that and you're good to go!

Installing HaxeFlixel

To install HaxeFlixel, run these commands:

haxelib install flixel
haxelib install flixel-tools
haxelib run flixel-tools setup

You will then be prompted several times during the setup. Here's what you should do:

  1. When a command appears asking if you want to set up Flixel, press Y.
  2. When asked if you would like to download flixel-demos and flixel-templates, press Y.
  3. When prompted to enter an author name, either type in your name or leave the field blank. It will automatically use that name when creating project templates.
  4. When asked to choose your default IDE, enter the number corresponding to your development tool of choice.
  5. Choose either Y or N when asked if you want to automatically open created templates and demos with your IDE of choice. This will just immediately open your project in your IDE instead of requiring you to navigate your filesystem.
  6. On Macs, if you chose to have templates and demos automatically open, you will be asked whether or not you want to run a symlink command. Press Y.

If you ever need to change these settings, you can run the Flixel tools setup command again.

You have been reading a chapter from
Haxe Game Development Essentials
Published in: Nov 2015
Publisher:
ISBN-13: 9781785289781
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at $19.99/month. Cancel anytime
Banner background image