In the last few years, multiplatform development has become a must in the game developer’s skill set. Moai SDK is a great free and open source solution for this. This book will introduce you to the ways of developing games with Moai SDK using Lua; after reading it, you should be good to go and create the next hit mobile game!
We hope to see you around soon.
Welcome to Moai SDK!
Chapter 1, Why Moai SDK?, discusses the importance of multi-platform development and the advantages of using Moai SDK.
Chapter 2, Installing Moai SDK, helps us install Moai SDK on Windows and Mac OS X in a step-by-step manner.
Chapter 3, Basic Moai SDK Concepts, discusses the Action Tree, Node Graph, and Input Queue.
Chapter 4, Our First Game with Moai, starts work on a Concentration-like game. It discusses the gameplay and implements the entry point for our game.
Chapter 5, Showing Images on the Screen, introduces the notions of Decks and Props and guides you in showing your first image on the screen.
Chapter 6, Resource Manager, guides you through the creation of a Lua module that will be in charge of interfacing between your game and your assets. It will be used to cache textures, sounds, and fonts, and to avoid loading the code repeatedly.
Chapter 7, Concentration Gameplay, teaches us how to use grids and tilesets, and how to process input.
Chapter 8, Let’s Build a Platformer!, guides you through the first steps in making a platformer prototype. You’ll learn how to implement a layered background with parallax effects and a main character with several animations on it.
Chapter 9, Real-world Physics with Box2D teaches us how to use Box2D as our physics engine, and implement a basic physics world.
Chapter 10, Creating a HUD, teaches us how to handle fonts and display them on screen. We’ll use them to show some debug info, but you can go anywhere from here.
Chapter 11, Let the Right Music In!, guides you in how to load audio files and play them.
Chapter 12, iOS Deployment, presents a case study on how to deploy to mobile devices, and guides you through all of the steps needed to make our Concentration game work on iOS.
Chapter 13, Deployment to Other Platforms, discusses the different platforms that are officially supported by Moai and points you in the right direction on how to deploy to them.
For this book you’ll need to have either Windows XP (or newer) or Mac OS X.
You’ll need to download and install Moai SDK and ZeroBrane Studio (refer to Chapter 2, Installing Moai SDK).
Moai SDK is a minimalist framework for professional game developers. This means that some of its features may be hard for complete beginners. However, this book aims to help beginners get into Moai SDK. You’ll need some basic understanding on programming (Lua knowledge is not required but extremely recommended) and basic command-line familiarity (in order to run our games).
In this book, you will find a number of styles of text that distinguish between different kinds of information. Here are some examples of these styles, and an explanation of their meaning.
Code words in text are shown as follows: “We’re creating a method called Game:start()
that will take care of initializing everything and controlling the game loop.”
A block of code is set as follows:
module(“Game”, package.seeall) GRID_COLS = 5 GRID_ROWS = 4 GRID_TILE_WIDTH = 62 GRID_TILE_HEIGHT = 62 BACK_TILE = 1
When we wish to draw your attention to a particular part of a code block, the relevant lines or items are set in bold:
WORLD_RESOLUTION_X = 320
WORLD_RESOLUTION_Y = 480
SCREEN_RESOLUTION_X = 2 * WORLD_RESOLUTION_X
SCREEN_RESOLUTION_Y = 2 * WORLD_RESOLUTION_Y
New terms and important words are shown in bold. Words that you see on the screen, in menus or dialog boxes for example, appear in the text like this: “Open up the ZeroBrane Studio and on the left panel (Project), click on the button with the ellipsis (...) and head to moai-sdk/samples/anim/anim-basic
, and click on OK”.
Feedback from our readers is always welcome. Let us know what you think about this book—what you liked or may have disliked. Reader feedback is important for us to develop titles that you really get the most out of.
To send us general feedback, simply send an e-mail to <[email protected]>
, and mention the book title via 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 on www.packtpub.com/authors.
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.
You can download the example code files for all Packt books you have purchased from your account at http://www.packtpub.com. 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.
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 would 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 on our website, or added to any list of existing errata, under the Errata section of that title. Any existing errata can be viewed by selecting your title from http://www.packtpub.com/support.
Piracy of copyright 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 <[email protected]>
with a link to the suspected pirated material.
We appreciate your help in protecting our authors, and our ability to bring you valuable content.
You can contact us at <[email protected]>
if you are having a problem with any aspect of the book, and we will do our best to address it.