Book Image

PhoneGap 2.x Mobile Application Development HOTSHOT

By : Kerri Shotts
Book Image

PhoneGap 2.x Mobile Application Development HOTSHOT

By: Kerri Shotts

Overview of this book

<p>Do you want to create mobile apps that run on multiple mobile platforms? With PhoneGap (Apache Cordova), you can put your existing development skills and HTML, CSS, and JavaScript knowledge to great use by creating mobile apps for cross-platform devices.</p> <p>"PhoneGap 2.x Mobile Application Development Hotshot" covers the concepts necessary to let you create great apps for mobile devices. The book includes ten apps varying in difficulty that cover the gamut – productivity apps, games, and more - that are designed to help you learn how to use PhoneGap to create a great experience.</p> <p>"PhoneGap 2.x Mobile Application Development Hotshot" covers the creation of ten apps, from their design to their completion, using the PhoneGap APIs. The book begins with the importance of localization and how HTML, CSS, and JavaScript interact to create the mobile app experience. The book then proceeds through mobile apps of various genres, including productivity apps, entertainment apps, and games. Each app covers specific items provided by PhoneGap that help make the mobile app experience better. This book covers the camera, geolocation, audio and video, and much more in order to help you create feature-rich mobile apps.</p>
Table of Contents (19 chapters)
PhoneGap 2.x Mobile Application Development HOTSHOT
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
InstallingShareKit 2.0
Index

Generating levels


It's hard to imagine a game without at least one level, and that level needs to have some sort of content in it. In this task, we'll examine how to generate content for the levels in our game.

Getting ready

Open the gameView.html file in www/views. We'll be using this file quite a bit, so it would be a good idea to have it open for reference.

Getting on with it

There are a few ways one can generate a level. One can use random content, pseudo-random content, or static content. The first is pretty easy: just use random numbers for everything. Unfortunately, this doesn't usually result in terribly nice levels, and there's little guarantee of winnability or difficulty.

The third method is also pretty easy: use static content. This means that you've determined the entire level ahead of time, and stored it in a file. When the game requests the level, it can be read back. This means it is the same every time, which can be good (or bad), depending on the game, but it also means that...