Android Game Programming For Dummies
by Derek James
Android Game Programming For Dummies
Published by
John Wiley & Sons, Inc.
111 River Street
Hoboken, NJ 07030-5774
www.wiley.com
Copyright 2013 by John Wiley & Sons, Inc., Hoboken, New Jersey
Published by John Wiley & Sons, Inc., Hoboken, New Jersey
Published simultaneously in Canada
No part of this publication may be reproduced, stored in a retrieval system or transmitted in any form or by any means, electronic, mechanical, photocopying, recording, scanning or otherwise, except as permitted under Sections 107 or 108 of the 1976 United States Copyright Act, without either the prior written permission of the Publisher, or authorization through payment of the appropriate per-copy fee to the Copyright Clearance Center, 222 Rosewood Drive, Danvers, MA 01923, (978) 750-8400, fax (978) 646-8600. Requests to the Publisher for permission should be addressed to the Permissions Department, John Wiley & Sons, Inc., 111 River Street, Hoboken, NJ 07030, (201) 748-6011, fax (201) 748-6008, or online at http://www.wiley.com/go/permissions .
Trademarks: Wiley, the Wiley logo, For Dummies, the Dummies Man logo, A Reference for the Rest of Us!, The Dummies Way, Dummies Daily, The Fun and Easy Way, Dummies.com, Making Everything Easier, and related trade dress are trademarks or registered trademarks of John Wiley & Sons, Inc. and/or its affiliates in the United States and other countries, and may not be used without written permission. Android is a trademark of Google Inc. All other trademarks are the property of their respective owners. John Wiley & Sons, Inc. is not associated with any product or vendor mentioned in this book.
Limit of Liability/Disclaimer of Warranty: The publisher and the author make no representations or warranties with respect to the accuracy or completeness of the contents of this work and specifically disclaim all warranties, including without limitation warranties of fitness for a particular purpose. No warranty may be created or extended by sales or promotional materials. The advice and strategies contained herein may not be suitable for every situation. This work is sold with the understanding that the publisher is not engaged in rendering legal, accounting, or other professional services. If professional assistance is required, the services of a competent professional person should be sought. Neither the publisher nor the author shall be liable for damages arising herefrom. The fact that an organization or Website is referred to in this work as a citation and/or a potential source of further information does not mean that the author or the publisher endorses the information the organization or Website may provide or recommendations it may make. Further, readers should be aware that Internet Websites listed in this work may have changed or disappeared between when this work was written and when it is read. FULFILLMENT OF EACH COUPON OFFER IS THE SOLE RESPONSIBILITY OF THE OFFEROR.
For general information on our other products and services, please contact our Customer Care Department within the U.S. at 877-762-2974, outside the U.S. at 317-572-3993, or fax 317-572-4002.
For technical support, please visit www.wiley.com/techsupport .
Wiley publishes in a variety of print and electronic formats and by print-on-demand. Some material included with standard print versions of this book may not be included in e-books or in print-on-demand. If this book refers to media such as a CD or DVD that is not included in the version you purchased, you may download this material at http://booksupport.wiley.com . For more information about Wiley products, visit www.wiley.com .
Library of Congress Control Number: 2012950501
ISBN 978-1-118-02774-5 (pbk); 978-1-118-23599-7 (ebk); ISBN 978-1-118-26083-8 (ebk); ISBN 978-1-118-22218-8 (ebk)
Manufactured in the United States of America
10 9 8 7 6 5 4 3 2 1
About the Author
Derek James is the founder and owner of Polyclef Software, one of the most successful Android indie game developers on Google Play. His apps and games have garnered over 1 million combined downloads, with multiple games receiving four-star or better ratings and holding top-ranking positions in their categories for many months. He was an early adopter of the Android platform and has been developing Android apps and games since the first device was released. He lives in Lafayette, Louisiana. You can follow Derek on Polyclefs Twitter feed ( @polyclefapps
), his blog ( http://polyclefsoftware.blogspot.com
), and his website ( polyclefsoftware.com
).
Dedication
To Jenna, who was there by my side throughout the writing of this book.
Authors Acknowledgments
Thanks to Acquisitions Editor Kyle Looper for contacting me to work on this book. Im grateful for the opportunity.
Thanks for Project Editor Pat OBrien for all the valuable and timely feedback in helping get this book put together.
Jeremy Breaux provided invaluable feedback as technical editor, helping to make sure that the code and examples worked well and were clear.
Finally, thanks to Laurie, as well as my friends and family for being supportive throughout the writing process.
Publishers Acknowledgments
Were proud of this book; please send us your comments at http://dummies.custhelp.com . For other comments, please contact our Customer Care Department within the U.S. at 877-762-2974, outside the U.S. at 317-572-3993, or fax 317-572-4002.
Some of the people who helped bring this book to market include the following:
Acquisitions, Editorial, and Vertical Websites
Project Editor: Pat OBrien
Acquisitions Editor: Kyle Looper
Copy Editor: Barry Childs-Helton
Technical Editor: Jeremy Breaux
Editorial Manager: Kevin Kirschner
Editorial Assistant: Leslie Saxman
Sr. Editorial Assistant: Cherie Case
Cover Photo: iStockphoto.com / Cary Westfall
Cartoons: Rich Tennant ( www.the5thwave.com )
Composition Services
Project Coordinator: Katherine Crocker
Layout and Graphics: Carrie A. Cesavice, Joyce Haughey, Christin Swinford
Proofreaders: Melissa Cossell, Shannon Ramsey
Indexer: BIM Indexing & Proofreading Services
Publishing and Editorial for Technology Dummies
Richard Swadley, Vice President and Executive Group Publisher
Andy Cummings, Vice President and Publisher
Mary Bednarek, Executive Acquisitions Director
Mary C. Corder, Editorial Director
Publishing for Consumer Dummies
Kathleen Nebenhaus, Vice President and Executive Publisher
Composition Services
Debbie Stailey, Director of Composition Services
T heres something special about games. The best games, the ones we remember, dont just relieve our boredom from time to time. They teach us new things, stretch our brains, or make us feel happy, excited, and sometimes angry! Social games can even bring us closer to our friends and family. We all have games that we think of fondly, that added something to our lives. Now, with the advent of smartphones, we can carry that experience around in our pockets and purses.
I still remember when my parents hooked up our first video game, Pong, to the family television. At the time that luminescent ball traversing the blurry screen was the coolest thing Id ever seen. Ive played a lot of games on a lot of platforms in the intervening years, but when my friend Philip gifted me with the first Android phone, the G1, I was skeptical that it would make a very good gaming platform. Who wants to play games by staring at a tiny screen on a device whose primary function is to make phone calls? Then again, the iPhone had by that time already proven that people were not only willing to play games on their smartphones, they were absolutely ravenous for games on their smartphones.