Sams Teach Yourself Android Game Programming in 24 Hours

Book description

In just 24 sessions of one hour or less, Sams Teach Yourself Android Game Programming in 24 Hours will help you master mobile game development for Android 4. Using a straightforward, step-by-step approach, you’ll gain hands-on expertise with the entire process: from getting access to the hardware via the Android SDK to finishing a complete example game. You’ll learn to use the Android SDK and open source software to design and build fast, highly playable games for the newest Android smartphones and tablets. Every lesson builds on what you’ve already learned, giving you a rock-solid foundation for real-world success!

Step-by-step instructions carefully walk you through the most common Android game programming tasks.

Quizzes and exercises at the end of each chapter help you test your knowledge.

By the Way notes present interesting information related to the discussion.

Did You Know? tips offer advice or show you easier ways to perform tasks.

Watch Out! cautions alert you to possible problems and give you advice on how to avoid them.

Jonathan Harbour is a writer and instructor whose love for computers and video games dates back to the Commodore PET and Atari 2600 era. He has a Master’s in Information Systems Management. His portfolio site at http://www.jharbour.com includes a discussion forum. He also authored Sams Teach Yourself Windows Phone 7 Game Programming in 24 Hours. His love of science fiction led to the remake of a beloved classic video game with some friends, resulting in Starflight—The Lost Colony (http://www.starflightgame.com).

Learn how to…

  • Install and configure the free development tools, including the Android 4 SDK, Java Development Kit, and Eclipse (or NetBeans)

  • Use the Android graphics system to bring your game characters to life

  • Load and manage bitmaps, and use double buffering for better performance

  • Incorporate timing and animation with threaded game loops

  • Tap into the touch screen for user input

  • Learn to use Android sensors such as the accelerometer, gyroscope, compass, light detector, and thermometer

  • Integrate audio into your games using the media player

  • Build your own game engine library to simplify gameplay code in your projects

  • Animate games with sprites using atlas images and fast matrix transforms

  • Employ object-oriented programming techniques using inheritance and data hiding

  • Create an advanced animation system to add interesting behaviors to game objects

  • Detect collisions and simulate realistic movement with trigonometry

  • Experiment with an evolving engine coding technique that more naturally reflects how games are written

  • Table of contents

    1. Title Page
    2. Copyright Page
    3. Contents at a Glance
    4. Table of Contents
    5. Foreword
    6. About the Author
    7. Dedication
    8. Acknowledgments
    9. We Want to Hear from You!
    10. Reader Services
    11. QR Barcodes
      1. Publisher’s Book Detail Link
      2. Author’s Website Link
    12. Introduction
    13. Part I: Introduction
      1. Hour 1. Introducing Android 4
        1. Hello, Android 4
        2. About the Android SDK
        3. About the Android NDK
        4. Android Dev System Requirements
        5. History of the Platform
        6. Android Hardware Specifications
        7. Summary
        8. Q&A
        9. Workshop
      2. Hour 2. Installing the Development Tools
        1. Installing the JDK
        2. Downloading the NetBeans Package
        3. Installing the Package
        4. Installing the Android SDK
        5. Downloading the SDK
        6. Installing the SDK
        7. Running the Android SDK Manager
        8. Installing the ADT Plug-in for Eclipse
        9. Summary
        10. Q&A
        11. Workshop
      3. Hour 3. Configuring NetBeans and Eclipse with the Android SDK
        1. Creating an Android Emulator Device
        2. Plugging Android SDK into NetBeans
        3. Adding Android SDK Support to Eclipse
        4. Summary
        5. Q&A
        6. Workshop
      4. Hour 4. Creating Your First Android Program
        1. Creating a New Android Project
        2. Building the New Project
        3. Editing the “Hello, Android!” Program
        4. Comparing the Emulator to an Android Device
        5. Summary
        6. Q&A
        7. Workshop
    14. Part II: Android Hardware
      1. Hour 5. Getting Started with Graphics
        1. Understanding the Activity Class
        2. Testing the Activity States
        3. World’s Simplest Android Graphics Demo
        4. Summary
        5. Q&A
        6. Workshop
      2. Hour 6. Drawing Basic Shapes and Text
        1. Drawing Basic Vector Shapes
        2. Drawing Text
        3. Writing Code for Javadoc
        4. Android Screen Densities and Resolutions
        5. Summary
        6. Q&A
        7. Workshop
      3. Hour 7. Loading and Drawing Images
        1. Double-Buffered Drawing
        2. Loading a Bitmap File
        3. Drawing a Bitmap
        4. Summary
        5. Q&A
        6. Workshop
      4. Hour 8. Bringing Your Game to Life with Looping
        1. Creating a Threaded Game Loop
        2. Drawing Without onDraw()
        3. The Runnable Animation Demo
        4. Summary
        5. Q&A
        6. Workshop
      5. Hour 9. Multi-Touch User Input
        1. Single-Touch Input
        2. Multi-Touch Input
        3. Summary
        4. Q&A
        5. Workshop
      6. Hour 10. Using the Accelerometer
        1. Android Sensors
        2. Summary
        3. Q&A
        4. Workshop
      7. Hour 11. Using the Linear Acceleration and Proximity Sensors
        1. Accessing the Linear Acceleration Sensor
        2. Accessing the Proximity Sensor
        3. Summary
        4. Q&A
        5. Workshop
      8. Hour 12. Using the Gravity and Pressure Sensors
        1. Using the Gravity Sensor
        2. Using the Pressure Sensor
        3. Summary
        4. Q&A
        5. Workshop
      9. Hour 13. Creating Your Own “Tricorder”
        1. Encapsulating the Android Sensors
        2. Creating the Tricorder Project
        3. Summary
        4. Q&A
        5. Workshop
      10. Hour 14. Playing with the Audio System
        1. Playing Audio Using MediaPlayer
        2. Playing Audio Using SoundPool
        3. Summary
        4. Q&A
        5. Workshop
    15. Part III: Android Gameplay
      1. Hour 15. Building an Android Game Engine
        1. Designing an Android Game Engine
        2. Creating an Android Library Project
        3. Writing the Core Engine Classes
        4. Engine Test Demo Project
        5. Summary
        6. Q&A
        7. Workshop
      2. Hour 16. Creating a Sprite/Actor Class
        1. Static Sprite as a “Prop”
        2. Dynamic Sprite as an “Actor”
        3. Encapsulating Basic Sprite Functionality
        4. Testing the Sprite Class
        5. Summary
        6. Q&A
        7. Workshop
      3. Hour 17. Frame Animation Using a Sprite Sheet/Atlas
        1. Animating with a Single Strip
        2. Animating with a Sprite Sheet (Texture Atlas)
        3. The Animation Demo
        4. Summary
        5. Q&A
        6. Workshop
      4. Hour 18. Advanced Multi-Animation Techniques
        1. Creating an Animation System
        2. Animation System Demo
        3. Summary
        4. Q&A
        5. Workshop
      5. Hour 19. Manipulating Sprites with Matrix Transforms
        1. Matrix Translation
        2. Matrix Rotation
        3. Matrix Scaling
        4. Matrix Transforms Demo
        5. Summary
        6. Q&A
        7. Workshop
      6. Hour 20. Entity Grouping
        1. Entity Grouping
        2. Summary
        3. Q&A
        4. Workshop
      7. Hour 21. Collision Detection
        1. Collision Detection Techniques
        2. Demonstrating Collisions
        3. Summary
        4. Q&A
        5. Workshop
      8. Hour 22. Using Linear Velocity for Realistic Movement
        1. Calculating Velocity from a Direction
        2. “Pointing” a Sprite in the Direction of Movement
        3. Enhancing the Engine
        4. Summary
        5. Q&A
        6. Workshop
      9. Hour 23. Scrolling the Background
        1. Background Scrolling Overview
        2. The Shoot-’Em-Up Game
        3. Summary
        4. Q&A
        5. Workshop
      10. Hour 24. Ball and Paddle Game
        1. Creating the Ball and Paddle Game
        2. Summary
        3. Q&A
        4. Workshop
    16. Index
    17. Ad Pages

    Product information

    • Title: Sams Teach Yourself Android Game Programming in 24 Hours
    • Author(s):
    • Release date: November 2012
    • Publisher(s): Sams
    • ISBN: 9780133033809