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

Setting up target platforms

To be able to deploy games on multiple platforms, a little extra work is involved. You're going to be using Flash, primarily, to develop your game, but we'll walk through what you need to download and set up for all of the major platforms that HaxeFlixel supports. We'll be going into detail about how to build each of these platforms in Chapter 7, Deploying to Multiple Platforms.

Flash

Haxe and OpenFL will build to Flash out of the box, so there's not really anything special you have to do in order to deploy to Flash. That said, to debug Flash content you should download the Flash debug player.

On Windows, you will be able to place breakpoints and inspect variables; on Mac, you will just get popups with stack traces when you get errors, which is still very useful. Unfortunately, Linux users will be unable to debug Flash in the browser, but you will still be able to use the content debugger application.

You can download the debug versions of the Flash player at https://www.adobe.com/support/flashplayer/downloads.html.

Tip

To debug Flash without a browser, download the projector content debugger application for your operating system. If you intend to primarily use the projector application, make sure that you set it up as the default application to run when loading SWF files.

To debug Flash in a browser, you will need to download different plugins based on the browser you intend to use. Here are some quick guidelines you can follow:

  • For Internet Explorer, use the ActiveX plugin
  • For Firefox and Safari, use the NPAPI plugin
  • For Chrome, use the PPAPI plugin

Android

OpenFL makes getting the tools you need to deploy to Android much easier than it typically is. Normally, this would involve downloading some tools and installing a bunch of SDKs. OpenFL has a tool that will guide you through the process as fast as possible.

Before using OpenFL's tool, ensure that you have the Java runtime installed. You can download it from https://java.com/en/download/. After installing the runtime, you can begin the Android setup process.

For Windows users, run this command to get started:

openfl setup android

For Mac and Linux users, run the command using sudo, like so:

sudo openfl setup android

After using sudo, you will have to enter your password to continue.

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

  • Press Y when asked if you want to download and install the Android SDK.
  • When asked to enter an output directory for the Android SDK, either enter a new path or just hit Enter to choose the default directory.
  • Press Y when asked whether or not you want to download and install the Android NDK.
  • When asked to enter an output directory for the Android NDK, either enter in a new path or just hit Enter to choose the default directory.
  • Press Y when asked whether or not you want to download and install Apache Ant.
  • When asked to enter an output directory for Apache Ant, either enter in a new path or just hit Enter to choose the default directory.
  • Press Y when asked whether or not you want to download and install the Java JDK. Press Y when asked to be taken to the download site of the JDK. Follow the download links on the site to download the JDK installer, and run and install it before continuing.
  • When asked to enter the path to the Android SDK, either you can enter a custom path type in it and continue, or hit Enter to continue with the default path.
  • When asked to enter the path to the Java JDK, type in the path you used to install the JDK earlier.

iOS

The setup process for iOS development is much simpler. Of course, in order to develop iOS games, you will need to use Max OS X and be a member of Apple's iOS developer program. You can sign up for the program by going here: https://developer.apple.com/programs/ios/. You will also need to install the latest version of Xcode, Apple's development tool, to develop iOS and OS X applications. You can download it by going to the Mac App store and searching for Xcode.

iOS

After Xcode has been installed, run this command in the terminal:

sudo lime setup ios

After using sudo, you will have to enter your password to continue.

When asked to download and install Apple Xcode, press N. This is only for users who haven't installed Xcode yet. It's easier to just install Xcode in advance like we did.

Desktop

HaxeFlixel can also be built to desktop targets. When you want to build your games for a particular desktop operating system, you will need to use that operating system to make the build. For example, you can't build a Mac game on Windows or vice versa.

When building for Windows, you will need to install a version of Visual Studio, Microsoft's application development tool that can build C++ and can target Windows 32-bit. If you don't already have a copy of Visual Studio that meets the requirements, you can download Visual Studio C++ 2010 Express at http://go.microsoft.com/?linkid=9709949.

After installing Visual Studio, you will also need to run this command:

openfl setup windows

When building for OS X, you will need to install Xcode. If you didn't install Xcode as part of the iOS setup, please refer to the section on how to download and install it.

Once Xcode is installed, run this command:

openfl setup mac

When asked to download and install Apple Xcode, press N.

When building for Linux, there are no special setup steps. You will just need to be running Linux when making builds.

Tip

It is worth noting that some more exotic Linux distributions may run into issues. If you're running into issues with developing for Linux, I suggest asking questions on OpenFL's community forum, located at http://community.openfl.org/.

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