Găsiți următorul dvs. carte preferat

Deveniți un membru astăzi și citiți gratuit pentru 30 zile
Corona SDK Mobile Game Development: Beginner's Guide - Second Edition

Corona SDK Mobile Game Development: Beginner's Guide - Second Edition

Citiți previzualizarea

Corona SDK Mobile Game Development: Beginner's Guide - Second Edition

Lungime:
843 pages
4 hours
Lansat:
Mar 31, 2015
ISBN:
9781783559350
Format:
Carte

Descriere

About This Book
  • From game physics to successful marketing, learn the fundamentals of Corona SDK for game development
  • Integrate your games with social networks such as Twitter and Facebook
  • This is a pragmatic guide explained in a step-by-step manner to create and deploy games quickly and efficiently
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.

Lansat:
Mar 31, 2015
ISBN:
9781783559350
Format:
Carte

Despre autor

Michelle M. Fernandez is a mobile game developer for iOS/Android devices and co-founder of MobiDojo (http://www.mobidojo.com). She is also a mentor for aspiring artists and programmers trying to break into the game industry. After experimenting with several game engines over the years, she was introduced to Corona SDK in late 2010 and has been an avid user of the program ever since. She enjoys creating tutorials and new game frameworks for others to learn from. When Michelle is not developing games, she is spending time with friends and family, playing video games, basketball, singing, or baking delicious pastries.

Legat de Corona SDK Mobile Game Development

Cărți conex
Articole conexe

Previzualizare carte

Corona SDK Mobile Game Development - Michelle M. Fernandez

Table of Contents

Corona SDK Mobile Game Development Beginner's Guide Second Edition

Credits

About the Author

About the Reviewers

www.PacktPub.com

Support files, eBooks, discount offers, and more

Why subscribe?

Free access for Packt account holders

Preface

What this book covers

What you need for this book

Who this book is for

Sections

Time for action – heading

What just happened?

Pop quiz – heading

Have a go hero – heading

Conventions

Reader feedback

Customer support

Downloading the example code

Downloading the color images of this book

Errata

Piracy

Questions

1. Getting Started with Corona SDK

Downloading and installing Corona

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

What just happened?

Time for action – setting up and activating Corona on Windows

What just happened?

Using the simulator on Mac and Windows

Time for action – viewing a sample project in the simulator

What just happened?

Have a go hero – use a different device shell

Choosing a text editor

Developing on devices

Time for action – downloading and installing Xcode

What just happened?

Time for action – creating a Hello World application in two lines of code

Time for action – modifying our application

Time for action – applying a new font name to our application

What just happened?

Have a go hero – adding more text objects

Testing our application on an iOS device

Time for action – obtaining the iOS developer certificate

What just happened?

Adding iOS devices

Xcode

iTunes

Time for action – adding/registering your iOS device

Time for action – creating an App ID

What just happened?

Provisioning profiles

Time for action – creating a provisioning profile

What just happened?

Application icon

Creating the Hello World build for iOS

Time for action – creating an iOS build

What just happened?

Time for action – loading an app on your iOS device

What just happened?

Testing our application on an Android device

Creating the Hello World build for Android

Time for action – creating an Android build

What just happened?

Time for action – loading an app on your Android device

What just happened?

Pop quiz – understanding Corona

Summary

2. Lua Crash Course and the Corona Framework

Lua to the rescue

Valuable variables

Global variables

Local variables

Table fields (properties)

Assignment conventions

Types of values

Time for action – printing values using blocks

What just happened?

Expressions

Arithmetic operators

Relational operators

Logical operators

Concatenation

The length operator

Precedence

Strings

Quoting strings

Time for action – getting our hands full of strings

What just happened?

Have a go hero – pulling some more strings

Tables

Passing a table as an array

Altering contents in a table

Populating a table

Objects

Display objects

Display properties

Object methods

Images

Loading an image

Image autoscaling

Time for action – placing images on screen

What just happened?

Have a go hero – adjusting display object properties

Runtime configuration

Dynamic content scaling

Dynamic content alignment

Dynamic image resolution

Frame rate control

Time for action – scaling display objects on multiple devices

What just happened?

Dynamic resolution images

Time for some shapes

Applying stroke width, fill color, and stroke color

Text, text, text

Applying color and string value

What are functions?

Defining a function

More display functions

Content size properties

Optimize your workflow

Use memory efficiently

Optimize your display images

Pop quiz – basics of Lua

Summary

3. Building Our First Game – Breakout

Breakout – bringing back old-school gaming

Understanding the Corona physics API

Setting up the physics world

Starting, pausing, and stopping the physics engine

physics.setGravity

physics.getGravity

Tilt-based gravity

physics.setScale

physics.setDrawMode

physics.setPositionIterations

physics.setVelocityIterations

Configuring the application

Build configuration

Time for action – adding the build.settings file

What just happened?

Dynamic scaling

Time for action – adding the config.lua file

What just happened?

Building the application

Displaying groups

display.newGroup()

Working with system functions

system.getInfo()

system.setAccelerometerInterval()

Time for action – creating variables for the game

What just happened?

Understanding events and listeners

Register events

Runtime events

enterFrame

Accelerometer

Touch events

Touch (single touch)

tap

Transitions

Creating menu screens

Time for action – adding the main menu screen

What just happened?

Have a go hero – creating a help screen

Creating the game play scene

Time for action – adding game objects

What just happened?

Time for action – building bricks

What just happened?

Have a go hero – focused platform gaming

Red alert!

Time for action – displaying game messages

What just happened?

Pop quiz – building a game

Summary

4. Game Controls

Moving in the up direction

Let's get even more physical

physics.addBody()

Time for action – starting physics for the paddle and ball

What just happened?

Paddle movement

Time for action – dragging the paddle in the simulator

What just happened?

Time for action – moving the paddle with the accelerometer

What just happened?

Ball collision with the paddle

Time for action – making the ball bounce against the paddle

What just happened?

Removing objects from the scene

Variable references

Brick by brick

Time for action – removing the bricks

What just happened?

Directional changes

Time for action – updating the ball

What just happened?

Transitioning levels

Time for action – resetting and changing levels

What just happened?

Have a go hero –add more levels

You win some, you lose some

Time for action –making win and lose conditions

What just happened?

Activating event listeners

Collision events

Global collision listeners

Local collision listeners

Time for action – adding game listeners

What just happened?

Have a go hero – let's turn everything upside down

The results are in!

Pop quiz – working with game controls

Summary

5. Animating Our Game

Panda Star Catcher

Let's get everything moving

Transitions

Easing

The value of timed functions

Timers

What are image sheets?

It's sprite mania!

Image sheet API

Game time!

Time for action – setting up the variables

What just happened?

Let's start the round

Time for action – starting the game

What just happened?

Poof! Be gone!

Time for action – reloading the panda on the stage

What just happened?

Earning some points

Time for action – tracking the score

What just happened?

When the game ends

Time for action – displaying the game over screen

What just happened?

Background display

Time for action – adding the background elements

What just happened?

Heads up!

Time for action – displaying the timer and score

What just happened?

Time after time

Time for action – setting up the timer

What just happened?

It's so glowy

Time for action – making the power shot

What just happened?

Pandas!

Time for action – creating the panda character

What just happened?

Starry skies

Time for action – creating star collisions

What just happened?

Have a go hero – tracking the star count

Screen touches

Time for action – launching the panda

What just happened?

Organizing display objects

Time for action – reordering layers

What just happened?

Creating stars

Time for action – creating stars in the level

What just happened?

Starting the game

Time for action – initializing the game

What just happened?

Pop quiz – animating graphics

Summary

6. Playing Sounds and Music

Corona audio system

Sound formats

Sound filename limitations on Android

Mono sounds at their best

Maximum number of simultaneous channels

Time to play

audio.loadSound()

audio.loadStream()

audio.play()

Looping

Simultaneous playback

Time for action – playing audio

What just happened?

Have a go hero – repeating audio with delay

Time to take control

audio.stop()

audio.pause()

audio.resume()

audio.rewind()

Time for action – controlling audio

What just happened?

Memory management

audio.dispose()

Have a go hero – disposing audio

Alterations to audio

Volume control

audio.setVolume()

audio.setMinVolume()

audio.setMaxVolume()

audio.getVolume()

audio.getMinVolume()

audio.getMaxVolume()

Fading audio

audio.fade()

audio.fadeOut()

Performance tips

Preloading phase

audioPlayFrequency

Patents and royalties

Pop quiz – all about audio

Summary

7. Physics – Falling Objects

Creating our new game – Egg Drop

Starting variables

Time for action – setting up the variables

What just happened?

Controlling the main character

Time for action – moving the character

What just happened?

Have a go hero – adding touch events

Updating the score

Time for action – setting the score

What just happened?

Displaying the game environment

Time for action – drawing the background

What just happened?

Displaying the heads-up display

Time for action – designing the HUD

What just happened?

Creating the game lives

Time for action – counting the lives

What just happened?

Have a go hero – adding images for the game lives

Introducing the main character

Complex body construction

Time for action – creating the character

What just happened?

Adding postcollisions

Collision handling

Body properties

body.isAwake

body.isBodyActive

body.isBullet

body.isSensor

body.isSleepingAllowed

body.isFixedRotation

body.angularVelocity

body.linearDamping

body.angularDamping

body.bodyType

Time for action – creating the egg collision

What just happened?

Making the display objects fall

Time for action – adding the egg object

What just happened?

Time for action – making the egg drop

What just happened?

Ending the game play

Time for action – calling game over

What just happened?

Starting the game

Time for action – activating the game

What just happened?

Pop quiz – animating the graphics

Summary

8. Operation Composer

Continuation of Egg Drop

Data saving

BeebeGames class for saving and loading values

Getting paths to files

Reading files

Writing files

Time for action – saving and loading the high score

What just happened?

Pausing the game

Time for action – pausing the game

What just happened?

The Composer API

Game development with the Composer API

Time for action – altering the game file

What just happened?

Organizing the game

Time for action – adding the new main.lua file

What just happened?

New game transitions

Time for action – changing screens after the game is over

What just happened?

Have a go hero – restarting the game

Creating a loading screen

Time for action – adding the loading screen

What just happened?

Creating a main menu

Time for action – adding a main menu

What just happened?

Creating an options menu

Time for action – adding an options menu

What just happened?

Creating a credits screen

Time for action – adding a credits screen

What just happened?

Have a go hero – adding more levels

Pop quiz – game transitions and scenes

Summary

9. Handling Multiple Devices and Networking Your Apps

Return to configuration

Build configuration

Orientation support (iOS)

Orientation support (Android)

Version code and version name (Android)

Application permissions (Android)

Content scaling on an easier level

The best of both worlds

The deeper meaning of dynamic image selection

High-resolution sprite sheets

Networking your apps

Posting to Twitter

Time for action – adding Twitter to your apps

What just happened?

Posting to Facebook

Time for action – adding Facebook to your apps

What just happened?

Facebook Connect

Time for action – posting scores using Facebook Connect

What just happened?

Have a go hero – create a dialog box

Pop quiz – handling social networks

Summary

10. Optimizing, Testing, and Shipping Your Games

Understanding memory efficiency

Graphics

Group objects

Turning off animations when they're not being used

Optimizing image sizes

Distributing iOS applications

Prepping your app icons

Time for action – setting up your distribution certificate and provisioning profile for the App Store

What just happened?

iTunes Connect

Contracts, tax, and banking

Time for action – managing your application in iTunes Connect

What just happened?

Building an iOS application for distribution in Corona

Time for action – building your application and uploading it to the Application Loader

What just happened?

Have a go hero – making a universal iOS build

The Google Play Store

Creating launcher icons

Time for action – signing your app for the Google Play Store

What just happened?

Time for action – submitting an app to the Google Play Store

What just happened?

Have a go hero – adding more promos

Pop quiz – publishing applications

Summary

11. Implementing In-App Purchases

The wonders of In-App Purchase

Types of In-App Purchases

Corona's store module

store.init()

event.transaction

store.loadProducts()

event.products

event.invalidProducts

store.canMakePurchases

store.purchase()

store.finishTransaction()

store.restore()

Create an In-App Purchase

Time for action – creating the In-App Purchase in iTunes Connect

What just happened?

Time for action – using the Corona store module to create an In-App Purchase

What just happened?

Have a go hero – handling multiple Product IDs

Testing In-App Purchases

User test accounts

Time for action – testing the In-App Purchase with the Breakout In-App Purchase Demo

What just happened?

Have a go hero – using other In-App Purchase types

Pop quiz – all about In-App Purchases

Summary

A. Pop Quiz Answers

Chapter 1 – Getting Started with Corona SDK

Pop quiz – understanding Corona

Chapter 2 – Lua Crash Course and the Corona Framework

Pop quiz – basics of Lua

Chapter 3 – Building Our First Game – Breakout

Pop quiz – building a game

Chapter 4 – Game Controls

Pop quiz – working with game controls

Chapter 5 – Animating Our Game

Pop quiz – animating graphics

Chapter 6 – Playing Sounds and Music

Pop quiz – all about audio

Chapter 7 – Physics – Falling Objects

Pop quiz – animating the graphics

Chapter 8 – Operation Composer

Pop quiz – game transitions and scenes

Chapter 9 – Handling Multiple Devices and Networking Your Apps

Pop quiz – handling social networks

Chapter 10 – Optimizing, Testing, and Shipping Your Games

Pop quiz – publishing applications

Chapter 11 – Implementing In-App Purchases

Pop quiz – all about In-App Purchases

Index

Corona SDK Mobile Game Development Beginner's Guide Second Edition


Corona SDK Mobile Game Development Beginner's Guide Second Edition

Copyright © 2015 Packt Publishing

All rights reserved. No part of this book may be reproduced, stored in a retrieval system, or transmitted in any form or by any means, without the prior written permission of the publisher, except in the case of brief quotations embedded in critical articles or reviews.

Every effort has been made in the preparation of this book to ensure the accuracy of the information presented. However, the information contained in this book is sold without warranty, either express or implied. Neither the author, nor Packt Publishing, and its dealers and distributors will be held liable for any damages caused or alleged to be caused directly or indirectly by this book.

Packt Publishing has endeavored to provide trademark information about all of the companies and products mentioned in this book by the appropriate use of capitals. However, Packt Publishing cannot guarantee the accuracy of this information.

First published: April 2012

Second edition: March 2015

Production reference: 1250315

Published by Packt Publishing Ltd.

Livery Place

35 Livery Street

Birmingham B3 2PB, UK.

ISBN 978-1-78355-934-3

www.packtpub.com

Credits

Author

Michelle M. Fernandez

Reviewers

Oguz Konya

Zeheng Li

Volodymyr Sergeyev

Jason Slater

Commissioning Editor

Usha Iyer

Acquisition Editor

Reshma Raman

Content Development Editor

Sumeet Sawant

Technical Editor

Vivek Arora

Copy Editors

Charlotte Carneiro

Pranjali Chury

Karuna Narayanan

Alfida Paiva

Vikrant Phadke

Project Coordinator

Danuta Jones

Proofreaders

Safis Editing

Maria Gould

Indexer

Priya Sane

Production Coordinator

Shantanu N. Zagade

Cover Work

Shantanu N. Zagade

About the Author

Michelle M. Fernandez is a mobile game developer and cofounder of MobiDojo (http://www.mobidojo.com). She is also a mentor to aspiring artists and programmers trying to break into the game industry. After experimenting with several game engines over the years, she was introduced to Corona SDK in late 2010 and has been an avid user of the program ever since. She enjoys creating tutorials and new game frameworks for others to learn from. When Michelle is not developing games, she is spending time with friends and family, playing video games, traveling, and constantly learning new design paradigms.

I would first and foremost like to thank my family and friends for their love and encouragement throughout the production of this book. I'd like to thank David Roper for his support and patience during this project and for always pushing me to do my best and succeed. I'd also like to thank April Quileza and Yanglyn Ou who have always been there for me to help review my work and who become my personal cheerleaders when things get hectic. My greatest appreciation goes out to Carlos Icaza, who has been a wonderful mentor and a great friend. I would like to acknowledge Walter Luh for continuing to give Corona developers an amazing platform to work with. A big thanks to all of the Packt staff for giving me this opportunity to share my love and knowledge of mobile game development through this book.

About the Reviewers

Oguz Konya is a game developer based in Istanbul, Turkey, and holds a master's degree in game technologies. He has been developing games and simulations for the last 4 years and is currently working as a game developer at Dodisoft Games. He is a hardcore gamer and enjoys playing games with his wife, who is scarily getting better and better at beating him at FPS games.

Zeheng Li is a PhD student in computer science at Southern Methodist University. He is interested in the synergy of machine learning and natural language processing in the software engineering domain. He holds a bachelor's degree in computer science and a master's degree in management information systems. Prior to his doctoral study, he worked for a start-up, focusing on mobile and web development. He is passionate about coding and problem solving.

Volodymyr Sergeyev is a software developer and computer science enthusiast.

I would like to thank my wife, Inna; daughter, Vlada; and son, Arsen; for their patience and love. These helps me a lot in everyday work! Also, I want to give my love to my parents, Ludmyla and Volodymyr. I love you all.

Jason Slater is a technology journalist, blogger, and software developer with over 25 years of industrial experience in building, managing, and writing about scalable, distributed, and web-based applications. He is a member of the British Computer Society and holds a master's degree in computer science (Internet technologies) with distinction.

Jason is the editor of a popular technology blog (http://www.jasonslater.com) and is a regular contributor to technology-based publications, radio, and television.

You can reach and follow him on Twitter; his Twitter handle is @jasonslater.

www.PacktPub.com

Support files, eBooks, discount offers, and more

For support files and downloads related to your book, please visit www.PacktPub.com.

Did you know that Packt offers eBook versions of every book published, with PDF and ePub files available? You can upgrade to the eBook version at www.PacktPub.com and as a print book customer, you are entitled to a discount on the eBook copy. Get in touch with us at for more details.

At www.PacktPub.com, you can also read a collection of free technical articles, sign up for a range of free newsletters and receive exclusive discounts and offers on Packt books and eBooks.

https://www2.packtpub.com/books/subscription/packtlib

Do you need instant solutions to your IT questions? PacktLib is Packt's online digital book library. Here, you can search, access, and read Packt's entire library of books.

Why subscribe?

Fully searchable across every book published by Packt

Copy and paste, print, and bookmark content

On demand and accessible via a web browser

Free access for Packt account holders

If you have an account with Packt at www.PacktPub.com, you can use this to access PacktLib today and view 9 entirely free books. Simply use your login credentials for immediate access.

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

Action 1

Action 2

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

Ați ajuns la sfârșitul acestei previzualizări. Înscrieți-vă pentru a citi mai multe!
Pagina 1 din 1

Recenzii

Ce părere au oamenii despre Corona SDK Mobile Game Development

0
0 evaluări / 0 Recenzii
Ce părere aveți?
Evaluare: 0 din 5 stele

Recenziile cititorilor