Book Image

Corona SDK Mobile Game Development: Beginner's Guide

By : Michelle M Fernandez
Book Image

Corona SDK Mobile Game Development: Beginner's Guide

By: Michelle M Fernandez

Overview of this book

Table of Contents (19 chapters)
Corona SDK Mobile Game Development Beginner's Guide Second Edition
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
Index

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. Aside from developing games, you will also dive into learning about social network integration, In-App Purchasing, and shipping your applications to the Apple App Store and/or Google Play Store.

What this book covers

Chapter 1, Getting Started with Corona SDK, begins by teaching you how to install Corona SDK on both the Mac OS X 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. You'll learn how to structure game files in a Corona project and create game objects that will be displayed on screen.

Chapter 4, Game Controls, continues with the second 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 scoring system that will implement the win and lose conditions of the game.

Chapter 5, Animating Our Game, explains how to animate a game using 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 your 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 the physical behavior 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 Composer, discusses how to manage all your game scenes with Composer 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. 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 Apple App Store and manage your app information in iTunes Connect. Android developers will learn how to sign their applications for publication so they can be submitted to the Google Play Store.

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

Appendix, Pop Quiz Answers, covers all the answers enlisted in the pop quiz sections of the book.

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, ensure that your system has:

    • Mac OS X 10.9 or later

    • An Intel-based system that runs Lion, Mountain Lion, Mavericks, or Yosemite

    • 64-bit CPU (Core 2 Duo)

    • OpenGL 2.0 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, ensure that your system has:

    • Windows 8, Windows 7, Vista, or XP (Service Pack 2) operating system

    • 1 GHz processor (recommended)

    • 80 MB of disk space (minimum)

    • 1 GB of RAM (minimum)

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

    • 32-bit (x86) version of the Java Development Kit (JDK)

    • The Android SDK is not required to create Android device builds with Corona on Mac or Windows

  • Java 6 SDK

  • A text editor such as Notepad ++

You must be enrolled as a 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 Publishing website.

Lastly, you will need the latest stable build of Corona SDK. This is applicable for all subscription levels.

Who this book is for

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

Sections

In this book, you will find several headings that appear frequently (Time for action, What just happened?, Pop quiz, and Have a go hero).

To give clear instructions on how to complete a procedure or task, we use these sections as follows:

Time for action – heading

  1. Action 1

  2. Action 2

  3. Action 3

Instructions often need some extra explanation to ensure they make sense, so they are followed with these sections:

What just happened?

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

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

Pop quiz – heading

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

Have a go hero – heading

These are practical challenges that give you ideas to experiment with what you have learned.

Conventions

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, database table names, folder names, filenames, file extensions, pathnames, dummy URLs, user input, and Twitter handles are shown as follows: "We can include other contexts through the use of the include directive."

A block of code is set as follows:

textObject = display.newText( "Hello World!", 160, 80, native.systemFont, 36 )
textObject: setFillColor ( 1, 1, 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:

    local buyLevel2 = function ( product ) 
      print ("Congrats! Purchasing " ..product)

     -- Purchase the item
      if store.canMakePurchases then 
        store.purchase( {validProducts[1]} ) 
      else
        native.showAlert("Store purchases are not available, please try again later",  { "OK" } ) – Will occur only due to phone setting/account restrictions
      end 
    end 
    -- Enter your product ID here
     -- Replace Product ID with a valid one from iTunes Connect
     buyLevel2("com.companyname.appname.NonConsumable")

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

keytool -genkey -v -keystore my-release-key.keystore -alias aliasname -keyalg RSA -validity 999999

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: "Click on the Enroll Now button and follow Apple's instructions to complete the process."

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 Publishing 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 https://www.packtpub.com/sites/default/files/downloads/9343OT_ColoredImages.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.