Search icon
Arrow left icon
All Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Newsletters
Free Learning
Arrow right icon
Corona SDK Mobile Game Development: Beginner's Guide
Corona SDK Mobile Game Development: Beginner's Guide

Corona SDK Mobile Game Development: Beginner's Guide: You don't need to be a programming whiz to create iOS and Android games. You just need this great hands-on guide to Corona SDK, which teaches you everything from game physics to successful marketing.

$32.99 $22.99
Book Apr 2012 408 pages 1st Edition
eBook
$32.99 $22.99
Print
$54.99
Subscription
$15.99 Monthly
eBook
$32.99 $22.99
Print
$54.99
Subscription
$15.99 Monthly

What do you get with eBook?

Product feature icon Instant access to your Digital eBook purchase
Product feature icon Download this book in EPUB and PDF formats
Product feature icon Access this title in our online reader with advanced features
Product feature icon DRM FREE - Read whenever, wherever and however you want
Buy Now

Product Details


Publication date : Apr 24, 2012
Length 408 pages
Edition : 1st Edition
Language : English
ISBN-13 : 9781849691888
Category :

Estimated delivery fee Deliver to Malaysia

Standard 10 - 13 business days

$8.95

Premium 5 - 8 business days

$45.95
(Includes tracking information)
Table of content icon View table of contents Preview book icon Preview Book

Corona SDK Mobile Game Development: Beginner's Guide

Chapter 1. Getting Started With Corona SDK

Before we jump right into coding some simple games, we need to install and run the necessary programs that will make our applications come to life. Corona SDK is primarily a 2D development engine. If you've had experience developing for iOS or Android, you will find the experience working with Corona refreshing and simple to use. In no time you'll be creating finished products to distribute on the iPhone App Store and Google Play Store.

In this chapter, we will:

  • Set up Corona SDK on Mac OS X and Windows

  • Install Xcode for Mac OS X

  • Create a Hello World program in two lines

  • Add devices in the iOS Provisioning Portal

  • Load an application to an iOS device

  • Load an application to an Android device

Downloading and installing Corona


You have the option of choosing the Mac OS X or Microsoft Windows operating system to develop on. Keep in mind the following system requirements required to run the program.

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

  • Mac OS® X 10.6 or later

  • An Intel-based system that runs Snow Leopard or Lion

  • 64-bit CPU (Core 2 Duo)

  • An OpenGL 1.4 or higher graphics system

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)

Time for action – setting up and activating Corona on Mac OS X


Let's begin by setting up Corona SDK on our desktop.

  1. If you haven't downloaded the SDK, please do so at: http://www.anscamobile.com/corona/. You will have to register as a user before you can access the SDK.

  2. The file extension for any Mac program should end in .dmg, otherwise known as an Apple disk image. Once you've downloaded the disk image, double-click on the disk image file to mount it. The name should be similar to CoronaSDK.dmg.

    Once it is loaded, you should see the mounted disk image folder as shown in the following screenshot:

  3. Next, drag the CoronaSDK folder into the Applications folder. This will copy the contents of the Corona folder into /Applications. You will be prompted to enter an administrator password if you are not the main administrator of the account. You will be able to see the CoronaSDK folder in /Applications once it has been successfully installed.

    For easy access to the folder's contents, create an alias by dragging the CoronaSDK folder to the Dock of your Mac desktop.

    First time Corona SDK users will have to perform a quick and easy one-time authorization process before it canbe accessible.

    Note

    You must be connected to the Internet to complete the authorization process.

  4. Launch the Corona Simulator in the SDK folder.

  5. Assuming this is your first time, you will be presented with an End-user License Agreement (EULA). Once you have accepted the agreement, enter the e-mail you used to register for Corona and password to activate the SDK. Otherwise, click Register to create an account.

    Note

    If you register with Corona as a trial user, there is no fee to develop on iOS and/or Android devices. Developers that would like to publish their applications on the App Store or Google Play need to purchase the Corona SDK subscription on the website in order to do so at: http://www.anscamobile.com/corona/.

  6. Upon successful login, you will get a confirmation dialog to show that the SDK is ready to use as shown in the following screenshot:

  7. Click on the Continue button and you'll be presented with the Welcome to Corona screen as shown in the following screenshot:

What just happened?

Setting up Corona SDK on your Mac operating system is as simple as installing any other dedicated Mac program. After you have authorized the SDK on your machine and logged in with your e-mail and password it will be ready for use. From here on out, every time you launch Corona, it will automatically log in to your account. You will notice that you are greeted with a Corona SDK screen when this happens.

Time for action – setting up and activating Corona on Windows


Let's set up Corona SDK on our desktop.

  1. Download Corona SDK from the following URL: http://www.anscamobile.com/corona/. You will have to register as a user before you can access the SDK.

  2. The file extension for the Windows version of Corona should end in .msi, otherwise known as a Windows Installer, a component of Windows made for installing programs by Microsoft. Double-click on the file. The filename should be similar to CoronaSDK.msi.

  3. Follow the onscreen directions for installation.

  4. Corona will install directly to your Programs folder by default. On Microsoft Windows, select Corona from the list of Programs in your Start menu or double-click the Corona icon on the desktop. Upon successful activation, you should begreeted with the following screen:

    Note

    The process to activate the SDK should be the same as that of the Mac procedure once you launch Corona for the very first time.

    Tip

    If you run into issues with images not displaying properly, check to see if you're using an up-to-date OpenGL graphics driver that is 1.3 or higher.

    Note

    Be aware that Corona SDK on Windows can only build for Android devices, not for iOS devices (iPhone, iPad, or iPod Touch). A Mac can only build for iOS devices in Corona but can also build applications for Android.

  5. To create device builds, Java 6 SDK needs to be installed on your PC. You will need to go to the JDK download page: http://jdk6.java.net/download.html and click the Download button under the Java SE 6 option.

  6. On the next page, select the Accept License Agreement radio button and then click on the Windows x86 link to download the installer. You will be asked to log in or create a user account on the Oracle website if you don't already have one.

  7. As soon as the JDK is downloaded, run the installer. Once installed, you'll be able to create device builds for Android on your PC.

What just happened?

Installing the SDK on Windows has a different setup to that of the Mac OS X. While executing the installer file, Windows will automatically present a designated location to install the application such as the Programs folder so you won't have to manually choose a destination. Upon a successful installation you will see the Corona SDK icon on your desktop for easy access or highlighted in the Programs list in the Start menu, assuming you're accessing it for the first time. When you authorize Corona on your machine and sign in with your login information, it is ready for you to use and will lo in automatically every time it is launched.

Using the simulator on Mac and Windows


On Mac OS X, launch Corona SDK by either selecting Corona Terminal or Corona Simulator from the Applications Directory. Both selections will access the SDK. The Corona Simulator will only open the simulator. The Corona Terminal will open both the simulator and terminal window. The terminal is helpful for debugging your programs and displays simulator errors/warnings and print() messages.

On Microsoft Windows, select the Corona SDK folder and click on Corona Simulator from the list of Programs in your Start menu or double-click the Corona icon on the desktop. (The simulator and terminal are always opened together if you are using Windows).

Let's go over the useful contents contained in the Corona SDK folder (located in Applications/Corona SDK on Mac and Start/All Programs/Corona SDK on Windows:

  • Debugger (Mac)/Corona Debugger (Windows)—Tool for finding and isolating issues in your code.

  • Corona Simulator—The environment used to launch your application for testing. It simulates the mobile device you're developing on your local computer. (On Windows, it will open both the simulator and terminal).

  • Corona Terminal—Launches the Corona Simulator and opens a Terminal window to display error/warning messages and print() statements. It is very helpful for debugging your code (only on Mac).

  • Simulator—Has the same properties as Corona Terminal, but called from the command line (only on Mac).

  • SampleCode—A set of sample applications to get you started with Corona. Contains code and art assets to work with.

The Corona SDK window opens by default when you launch the simulator. You can open a Corona project in the simulator, create a device build for testing or distribution, and view soe example games and apps to get you familiar with the SDK.

Time for action – viewing a sample project in the simulator


Let's take a look at the HelloPhysics sample project in the simulator:

  1. Click on Simulator in the Corona SDK window.

  2. In the Open dialog that appears, navigate to Applications/CoronaSDK/SampleCode/Physics/HelloPhysics (Mac) or C:\Program Files\Ansca\Corona SDK\Sample Code\Physics\HelloPhysics (Windows). On Mac, click Open and it will automatically open main.lua. On Windows, double-click on main.lua to open the file. The HelloPhysics application opens and runs in the Simulator.

What just happened?

Accessing the SDK through the Corona Terminal or Corona Simulator depends on your preference of action. Many Mac users prefer to use the Corona Terminal so they can track messages outputted in the terminal, especially for debugging purposes. When you launch the SDK through the Corona Simulator, the simulator will display, but not the terminal window. When Windows users launch the Corona Simulator, it will display both the simulator and terminal windows. This is nice to use when you want to play around with any of the example applications that are provided by Corona.

The main.lua file is a special filename that tells Corona where to start in a project folder. This file can also load other code files or other program resources such as sounds or graphics.

When you launch the HelloPhysics application in Corona, you will observe a box object fall from top of the screen in the simulator and collide with a ground object. The transition from launching the main.lua file to viewing the results in the simulator are almost immediate.

Have a go hero – use a different device shell

As you start getting familiar with the Corona Simulator, whether you're in Windows or Mac OSX, a default device is always used when you launch an application. Windows uses the Droid as the default device, while the Mac OS X uses the regular iPhone. Try launching the sample code on a different device shell to view the difference in screen resolution in all the devices the simulator has available.

When porting builds to more than one platform, you'll have to consider the variety of screen resolutions in both iOS and Android devices. A build is a compiled version of all your source code converted into one file. Having your game build configured for multiple platforms broadens the audience reach for your application.

Choosing a text editor


Corona does not have a designated program editor to code in so you will have to find one that suits your needs.

For Mac OS, TextWrangler is a good one and free too! You can download it at http://www.barebones.com/products/textwrangler/download.html. Other text editors such as BBEdit at http://www.barebones.com/thedeck and TextMate at http://macromates.com/ are great, but you will need to purchase those in order to use them. TextMate is also compatible with the Corona TextMate Bundle: http://www.ludicroussoftware.com/corona-textmate-bundle/index.html.

For Microsoft Windows Notepad++ is recommended and can be downloaded at http://notepad-plus-plus.org/ or Crimson Editor at http://www.crimsoneditor.com/. Both editors are free.

Any text editor, such as TextEdit for Mac or Notepad for Windows, that is already included in each operating system works as well, but it'll be easier to work with one that is designed for programming. For Corona, using an editor that supports Lua syntax highlighting will work the best when coding. Syntax highlighting adds formatting attributes to keywords and punctuation in a way that makes it easier for the reader to separate code from text.

Developing on devices


Apple's developer kit Xcode or the Android SDK is not necessary to download if you only want to use the Corona Simulator. In order to build and test your code on an iOS device (iPhone, iPod Touch and iPad), you will need to sign up as an Apple Developer and create and download provisioning profiles. If you want to develop on Android, you don't need to download the Android SDK unless you want to use the ADB tool to help with installing builds and viewing debug messages.

The trial version of Corona Simulator allows building Adhoc (for iOS) and Debug builds (Android) for testing on your own devices. The builds will contain a Trial User message box when the app runs on the device. You will need to purchase a Corona Subscription if you want to build for Apple's App Store or Android's Google Play Store. Corona Subscribers also get the benefit of subscriber-only features such as access to Daily Builds, Subscribers Only areas on the Corona forums and LaunchPad.

Left arrow icon Right arrow icon

Key benefits

  • Build once and deploy your games to both iOS and Android
  • Create commercially successful games by applying several monetization techniques and tools
  • Create three fun games and integrate them with social networks such as Twitter and Facebook

Description

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.

What you will learn

Optimize your game for mobile using touch and accelerometer Add sound and music to your game Master game physics such as collision detection Add achievements and leaderboards with OpenFeint and Game Center Monetize your game with in app purchase and advertising. Make your game socially aware by sharing messages and scores on Facebook and Twitter.

What do you get with eBook?

Product feature icon Instant access to your Digital eBook purchase
Product feature icon Download this book in EPUB and PDF formats
Product feature icon Access this title in our online reader with advanced features
Product feature icon DRM FREE - Read whenever, wherever and however you want
Buy Now

Product Details


Publication date : Apr 24, 2012
Length 408 pages
Edition : 1st Edition
Language : English
ISBN-13 : 9781849691888
Category :

Estimated delivery fee Deliver to Malaysia

Standard 10 - 13 business days

$8.95

Premium 5 - 8 business days

$45.95
(Includes tracking information)

Table of Contents

18 Chapters
Corona SDK Mobile Game Development Beginner's Guide Chevron down icon Chevron up icon
Credits Chevron down icon Chevron up icon
About the Author Chevron down icon Chevron up icon
About the Reviewers Chevron down icon Chevron up icon
www.PacktPub.com Chevron down icon Chevron up icon
Preface Chevron down icon Chevron up icon
1. Getting Started With Corona SDK Chevron down icon Chevron up icon
2. Lua Crash Course and the Corona Framework Chevron down icon Chevron up icon
3. Building our First Game: Breakout Chevron down icon Chevron up icon
4. Game Controls Chevron down icon Chevron up icon
5. Animating our Game Chevron down icon Chevron up icon
6. Playing Sounds and Music Chevron down icon Chevron up icon
7. Physics: Falling Objects Chevron down icon Chevron up icon
8. Operation Storyboard Chevron down icon Chevron up icon
9. Handling Multiple Devices and Networking your Apps Chevron down icon Chevron up icon
10. Optimizing, Testing, and Shipping your Games Chevron down icon Chevron up icon
11. Implementing In-App Purchases Chevron down icon Chevron up icon
Pop Quiz Answers Chevron down icon Chevron up icon

Customer reviews

Filter icon Filter
Top Reviews
Rating distribution
Empty star icon Empty star icon Empty star icon Empty star icon Empty star icon 0
(0 Ratings)
5 star 0%
4 star 0%
3 star 0%
2 star 0%
1 star 0%

Filter reviews by


No reviews found
Get free access to Packt library with over 7500+ books and video courses for 7 days!
Start Free Trial

FAQs

How do I buy and download an eBook? Chevron down icon Chevron up icon

Where there is an eBook version of a title available, you can buy it from the book details for that title. Add either the standalone eBook or the eBook and print book bundle to your shopping cart. Your eBook will show in your cart as a product on its own. After completing checkout and payment in the normal way, you will receive your receipt on the screen containing a link to a personalised PDF download file. This link will remain active for 30 days. You can download backup copies of the file by logging in to your account at any time.

If you already have Adobe reader installed, then clicking on the link will download and open the PDF file directly. If you don't, then save the PDF file on your machine and download the Reader to view it.

Please Note: Packt eBooks are non-returnable and non-refundable.

Packt eBook and Licensing When you buy an eBook from Packt Publishing, completing your purchase means you accept the terms of our licence agreement. Please read the full text of the agreement. In it we have tried to balance the need for the ebook to be usable for you the reader with our needs to protect the rights of us as Publishers and of our authors. In summary, the agreement says:

  • You may make copies of your eBook for your own use onto any machine
  • You may not pass copies of the eBook on to anyone else
How can I make a purchase on your website? Chevron down icon Chevron up icon

If you want to purchase a video course, eBook or Bundle (Print+eBook) please follow below steps:

  1. Register on our website using your email address and the password.
  2. Search for the title by name or ISBN using the search option.
  3. Select the title you want to purchase.
  4. Choose the format you wish to purchase the title in; if you order the Print Book, you get a free eBook copy of the same title. 
  5. Proceed with the checkout process (payment to be made using Credit Card, Debit Cart, or PayPal)
Where can I access support around an eBook? Chevron down icon Chevron up icon
  • If you experience a problem with using or installing Adobe Reader, the contact Adobe directly.
  • To view the errata for the book, see www.packtpub.com/support and view the pages for the title you have.
  • To view your account details or to download a new copy of the book go to www.packtpub.com/account
  • To contact us directly if a problem is not resolved, use www.packtpub.com/contact-us
What eBook formats do Packt support? Chevron down icon Chevron up icon

Our eBooks are currently available in a variety of formats such as PDF and ePubs. In the future, this may well change with trends and development in technology, but please note that our PDFs are not Adobe eBook Reader format, which has greater restrictions on security.

You will need to use Adobe Reader v9 or later in order to read Packt's PDF eBooks.

What are the benefits of eBooks? Chevron down icon Chevron up icon
  • You can get the information you need immediately
  • You can easily take them with you on a laptop
  • You can download them an unlimited number of times
  • You can print them out
  • They are copy-paste enabled
  • They are searchable
  • There is no password protection
  • They are lower price than print
  • They save resources and space
What is an eBook? Chevron down icon Chevron up icon

Packt eBooks are a complete electronic version of the print edition, available in PDF and ePub formats. Every piece of content down to the page numbering is the same. Because we save the costs of printing and shipping the book to you, we are able to offer eBooks at a lower cost than print editions.

When you have purchased an eBook, simply login to your account and click on the link in Your Download Area. We recommend you saving the file to your hard drive before opening it.

For optimal viewing of our eBooks, we recommend you download and install the free Adobe Reader version 9.