Book Image

Corona SDK Mobile Game Development: Beginner's Guide

Book Image

Corona SDK Mobile Game Development: Beginner's Guide

Overview of this book

Corona SDK is the fastest and easiest way to create commercially successful cross platform mobile games. Just ask Robert Nay, a 14 year old who created Bubble Ball - downloaded three million times, famously knocking Angry Birds off the top spot. You don't need to be a programming veteran to create games using Corona. Corona SDK is the number one tool for creating fun, simple blockbuster games. Assuming no experience at all with programming or game development you will learn the basic foundations of Lua and Corona right through to creating several monetized games deployable to Android and Apple stores. You will begin with a crash course in Lua, the programming language underpinning the Corona SDK tool. After downloading and installing Corona and writing some simple code you will dive straight into game development. You will start by creating a simple breakout game with controls optimized for mobile. You will build on this by creating two more games incorporating different features such as falling physics. The book ends with a tutorial on social network integration, implementing in app purchase and most important of all monetizing and shipping your game to the Android and App stores.
Table of Contents (18 chapters)
Corona SDK Mobile Game Development Beginner's Guide
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface

Preface

This book is designed to introduce you to the basic standards of using the Corona SDK across iOS and Android platforms. You will enhance your learning experience by building three unique games in easy-to-follow steps. Apart from developing games, you will also dive into learning about social network integration, In-App Purchasing, monetizing, and shipping your applications to the App Store and/or Google Play Store.

What this book covers

Chapter 1, Getting Started With Corona SDK, begins by teaching users how to install Corona SDK on both Mac OSX and Windows operating systems. You will learn how to create your first program in just two lines of code. Lastly, we'll go through the process of building and loading an application to an iOS or Android device.

Chapter 2, Lua Crash Course and the Corona Framework, dives into the Lua programming language that is used to develop in Corona SDK. We'll go over the basics of variables, functions, and data structures in Lua. This chapter will also introduce how to implement a variety of display objects within the Corona framework.

Chapter 3, Building our First Game: Breakout, discusses the first half of building your first game, Breakout. We'll learn how to structure game files in a Corona project and create game objects that will display on screen.

Chapter 4, Game Controls, continues on with the last half of building your first game, Breakout. We'll cover game object movement as well as collision detection between objects in the scene. You will also learn how to create a score system that will implement win and lose conditions of the game.

Chapter 5, Animating our Game, explains how to animate a game using movie clips and sprite sheets. This chapter will go in depth with managing motion and transitions while creating a new game framework.

Chapter 6, Playing Sounds and Music, provides information on how to apply sound effects and music to your applications. It is vital to include some type of audio to enhance the sensory experience of our game's development. You will learn how to incorporate audio through loading, executing, and looping techniques with the Corona Audio System.

Chapter 7, Physics: Falling Objects, covers how to implement the Box2D engine in Corona SDK using display objects. You will be able to customize body construction and work with physical behaviors of falling objects. In this chapter, we'll apply the uses of dynamic/static bodies and explain the purpose of post-collisions.

Chapter 8, Operation Storyboard, discusses how to manage all your game scenes with Storyboard API. We'll also go into detail on menu design, such as creating a pause menu and main menu. In addition, you'll learn how to save high scores within your game.

Chapter 9, Handling Multiple Devices and Networking your Apps, provides information about integrating your applications with social networks such as Twitter or Facebook. Other social capabilities that will be discussed are incorporating achievements and leaderboards with OpenFeint. This will enable your app to reach a bigger audience globally.

Chapter 10, Optimizing, Testing, and Shipping your Games, explains the application submission process for both iOS and Android devices. This chapter will guide you on how to set up a Distribution Provisioning Profile for the App Store and manage your app information in iTunes Connect. Android developers will learn how to sign their applications for publication so it can be submitted to the Google Play Store.

Chapter 11, Implementing In-App Purchases, covers monetization of your game by creating consumable, non-consumable, or subscription purchases. You will apply In-App Purchases in the App Store using Corona's store module. We'll take a look at testing purchases on a device to see if transactions have been applied using the Sandbox environment.

What you need for this book

You will need the following items before you can start developing games with Corona SDK for Mac:

  • If you are installing Corona for Mac OS X, be sure that your system is as follows:

    • Mac OS® X 10.6 or later

    • Intel-based system that runs Snow Leopard or Lion

    • 64-bit CPU (Core 2 Duo)

    • OpenGL 1.4 or higher graphics system

  • You must be enrolled in the Apple Developer Program

  • XCode

  • A text editor such as TextWrangler, BBEdit, or TextMate

You will need the following items before you can start developing games with Corona SDK for Windows:

  • If you are running Microsoft Windows, be sure that your system is as follows:

    • Windows 7, Vista, or XP operating system

    • 1 GHZ processor (recommended)

    • 38 MB of disk space (minimum)

    • 1 GB of RAM (minimum)

    • OpenGL 1.3 or higher graphics system (available in most modern Windows systems) 

  • Java 6 SDK

  • A text editor such as Notepad++ or Crimson Editor

You must be enrolled as an Google Play developer if you want to submit and publish apps for Android devices.

The game tutorials require resource files that are available with this book and can be downloaded from the Packt website.

Lastly, you will need the latest stable build of Corona SDK: Version 2011.704. This is applicable for test drivers and subscribers.

Who this book is for

This book is for anyone who wants to have a go at creating commercially successful games for Android and iOS. You don't need game development or programming experience.

Conventions

In this book, you will find several headings appearing frequently.

To give clear instructions of how to complete a procedure or task, we use:

Time for action – heading

  1. Action 1

  2. Action 2

  3. Action 3

Instructions often need some extra explanation so that they make sense, so they are followed with:

What just happened?

This heading explains the working of tasks or instructions that you have just completed.

You will also find some other learning aids in the book, including:

Pop quiz – heading

These are short multiple choice questions intended to help you test your own understanding.

Have a go hero – heading

These set practical challenges and give you ideas for experimenting with what you have learned.

You will also 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: "Continue changing values of the current display object, textObject."

A block of code is set as follows:

Hello World/    name of your project folder
Icon.png         required for iPhone/iPod/iPad
[email protected]       required for iPhone/iPod with Retina display
main.lua

When we wish to draw your attention to a particular part of a code block, the relevant lines or items are set in bold:

textObject = display.newText( "Hello World!", 50, 40, native.systemFont, 36 )
textObject:setTextColor( 124,252,0 )

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

--This is number 4
--This is number 5

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: "Once you have done so, under the Corona Simulator menu bar, select Window | View As | iPhone 4".

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 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 , and mention the book title via the subject of your message.

If there is a book that you need and would like to see us publish, please send us a note in the SUGGEST A TITLE form on www.packtpub.com or e-mail .

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.

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 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.

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 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/support, 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

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 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

You can contact us at if you are having a problem with any aspect of the book, and we will do our best to address it.