Book Image

Haxe Game Development Essentials

Book Image

Haxe Game Development Essentials

Overview of this book

Haxe is a powerful and high-level multi-platform language that's incredibly easy to learn. Used by thousands of developers and many high-profile companies, Haxe is quickly emerging as a forerunner in the area of cross-platform programming. OpenFL builds on top of Haxe to make developing for multiple platforms quick and painless. HaxeFlixel provides you with the tools you need to build amazing 2D games easier than ever before. Cross-platform development has been supercharged using the Haxe programming language, making it increasingly easy and hassle-free to develop multi-platform games. If you've programmed games before and want to learn out how to deliver games across multiple platforms, or develop games faster, then Haxe Game Development Essentials is the book for you. It starts by showing you how to set up your development environment, then running you through some Haxe language fundamentals, and finally taking you through the process of programming a game from start to finish. You will learn how to create a side scrolling shooter game using HaxeFlixel. Next you will learn to enhance the game with new gameplay features, user interfaces, animations, sound, and configuration files to make your game expandable. Once your game is built and ready, you will learn how to deploy it to web, Android, iOS, and desktop systems. By the end of this book, you will be confident about creating multi-platform games using Haxe, OpenFL, and HaxeFlixel in a faster and easier way.
Table of Contents (16 chapters)
Haxe Game Development Essentials
Credits
About the Author
Acknowledgements
About the Reviewers
www.PacktPub.com
Preface
Index

Preface

Developing games that can reach a wide audience can often be a serious challenge. A big part of the problem is figuring out how to make a game that will work on a wide range of hardware and operating systems. This is where Haxe comes in.

Over the course of this book, we'll look at getting started with Haxe and the HaxeFlixel game engine, build a side-scrolling shooter game that covers the core features you need to know, and prepare the game for deployment to multiple platforms.

After completing this book, you will have the skills you need to start producing your own cross-platform Haxe-driven games!

What this book covers

Chapter 1, Getting Started, explains setting up the Haxe and HaxeFlixel development environment and doing a quick Hello World example to ensure that everything is working.

Chapter 2, Building a New Game, looks at the fundamentals of the Haxe language and building the core foundation of our game.

Chapter 3, Dealing with Menus and Screen Flow, helps to set up our game's UI, add simple UI animations, and control the flow between screens.

Chapter 4, Delving into Animations and Gameplay, explains adding sprites and scripted animations and adding the bulk of our gameplay functionality.

Chapter 5, Adding Sound, delves into the aspects of adding music and sound effects to make our animations and gameplay truly engaging.

Chapter 6, Working with Configuration Files, talks of using JSON and XML configuration files to make our game expandable and editing the text far easier.

Chapter 7, Deploying to Multiple Platforms, shows how to take our completed game and build it to work on desktop, web, and mobile platforms.

Chapter 8, What's Next?, looks at game features to expand on and at resources to continue learning.

What you need for this book

The introductory chapter of the book will walk you through getting the tools you need to develop with. However, you will need a computer to develop with. You can develop games with Haxe on Apple OS X, Microsoft Windows, or Linux operating systems.

In order to develop a game for a particular operating system, you will need to have access to a machine with it installed to create playable builds. For example, you need to be using OS X to develop a game targeted at OS X.

For mobile platforms, you can use any operating system to develop Android applications, but you will need a Mac running OS X to develop iOS applications. You will also need an iOS device in order to develop for iOS; this can be an iPhone, iPad, or iPod Touch.

Who this book is for

This book is for game developers with some experience in programming games on one or more platforms already. If you want to leverage your game development experience on one platform to develop for multiple platforms and to get up and run quickly, this book is for you.

In addition, if you want to learn how using Haxe, OpenFL, and HaxeFlixel can make multiplatform development faster and easier, this book will show you.

Having prior experience with a language similar to Haxe, such as ActionScript or JavaScript, will help, but isn't required.

Conventions

In this book, you will find a number of text styles that distinguish between different kinds of information. Here are some examples of these styles and an explanation of their meaning.

Code words in text, database table names, folder names, filenames, file extensions, pathnames, dummy URLs, user input, and Twitter handles are shown as follows: "Open MenuState.hx and navigate inside the Create function."

A block of code is set as follows:

override public function create():Void
{
  super.create();
}

Any command-line input or output is written as follows:

lime test flash

New terms and important words are shown in bold. Words that you see on the screen, for example, in menus or dialog boxes, appear in the text like this: "If you're using FlashDevelop, you can create a class by right-clicking on the source folder and going to Add | New Class."

Note

Warnings or important notes appear in a box like this.

Tip

Tips and tricks appear like this.

Reader feedback

Feedback from our readers is always welcome. Let us know what you think about this book—what you liked or disliked. Reader feedback is important for us as it helps us develop titles that you will really get the most out of.

To send us general feedback, simply e-mail , and mention the book's title in the subject of your message.

If there is a topic that you have expertise in and you are interested in either writing or contributing to a book, see our author guide at www.packtpub.com/authors.

Customer support

Now that you are the proud owner of a Packt book, we have a number of things to help you to get the most from your purchase.

Downloading the example code

You can download the example code files from your account at http://www.packtpub.com for all the Packt Publishing books you have purchased. If you purchased this book elsewhere, you can visit http://www.packtpub.com/support and register to have the files e-mailed directly to you.

Downloading the color images of this book

We also provide you with a PDF file that has color images of the screenshots/diagrams used in this book. The color images will help you better understand the changes in the output. You can download this file from http://www.packtpub.com/sites/default/files/downloads/Haxe_GameDevelopment_Essentials_ColorImages.pdf.

Errata

Although we have taken every care to ensure the accuracy of our content, mistakes do happen. If you find a mistake in one of our books—maybe a mistake in the text or the code—we would be grateful if you could report this to us. By doing so, you can save other readers from frustration and help us improve subsequent versions of this book. If you find any errata, please report them by visiting http://www.packtpub.com/submit-errata, selecting your book, clicking on the Errata Submission Form link, and entering the details of your errata. Once your errata are verified, your submission will be accepted and the errata will be uploaded to our website or added to any list of existing errata under the Errata section of that title.

To view the previously submitted errata, go to https://www.packtpub.com/books/content/support and enter the name of the book in the search field. The required information will appear under the Errata section.

Piracy

Piracy of copyrighted material on the Internet is an ongoing problem across all media. At Packt, we take the protection of our copyright and licenses very seriously. If you come across any illegal copies of our works in any form on the Internet, please provide us with the location address or website name immediately so that we can pursue a remedy.

Please contact us at with a link to the suspected pirated material.

We appreciate your help in protecting our authors and our ability to bring you valuable content.

Questions

If you have a problem with any aspect of this book, you can contact us at , and we will do our best to address the problem.