Book Image

Corona SDK HOTSHOT

By : Nevin Flanagan
Book Image

Corona SDK HOTSHOT

By: Nevin Flanagan

Overview of this book

<p>If you've used the Corona Software Development Kit to build your very first new mobile app, you already know how easy it makes developing across all the pieces of this fragmented market. This book upgrades your knowledge of Lua and the Corona API with designs, habits and advanced concepts to speed your development and create more exciting apps.</p> <p>Corona SDK Hotshot will show you how to combine advanced Lua features such as coroutines and metatables with Corona's sophisticated tools, including physics and networking, to develop exactly the game or app you or your customers need, quickly and with an eye towards updating your app with improvements in the future.</p> <p>Corona SDK Hotshot will expand your basic knowledge of Corona with an insight into making the most of its event platform, using physics wisely and easily, and moving on to advanced programming tasks like path-finding.</p> <p>You will focus heavily on how to keep your programs understandable as they become more complicated, by using modules and events to divide it up. You'll practice ways to make AI scripts and map files easily understandable to designers and other collaborators, and use networks like GameCenter to publish progress.</p> <p>The last projects will combine the full range of covered material to illustrate how you can produce sophisticated and exciting apps as a Corona Hotshot!</p>
Table of Contents (18 chapters)
Corona SDK HOTSHOT
Credits
About the Author
Acknowledgement
About the Reviewers
www.PacktPub.com
Preface
Index

Tracking progress through the level


Games like this typically trigger enemy appearances and events based on how far the background has scrolled past the screen. To focus on the challenges of the project, we'll import the background itself and just add the scrolling logic to issue events that track this progress.

Getting ready

You should have already copied the partly completed project from the version 0 folder into your new project directory; if you haven't, do that now.

Getting on with it

We'll start by loading the new marsh background into the Ground layer of the game's view, instead of the blank rectangle that the project uses by default. Open the game.lua file and change the createScene function to load this module as the new background, as shown in the following code snippet:

  local group = self.view
  self.Ground = require "level.marsh"(group)
  self.Mobs = display.newGroup()

Then we adjust the scale of the background to make it fit into the width of the screen:

  self.Ground = require ...