You are previewing Sparrow iOS Game Framework Beginner's Guide.
O'Reilly logo
Sparrow iOS Game Framework Beginner's Guide

Book Description

Create mobile games for iOS devices with the Sparrow iOS Game Framework

In Detail

Sparrow is a game framework with a focus on ease-of-use and current state-of-the-art technologies. The Sparrow game framework is intended for 2D games and multimedia applications and has built-in support for animation, managing objects on the screen, and touch support.

Sparrow iOS Game Framework Beginner's Guide aims to teach a complete overview on how to develop a mobile game for iOS using Objective-C as the programming language and the Sparrow game framework. Instead of teaching concepts separately, this book will take a methodical approach, taking you through the development of an entire game using Sparrow's powerful framework.

What You Will Learn

  • Create display objects and learn how to render them on the screen
  • Animate objects on the screen
  • Develop your game for multiple devices such as the iPhone and the iPad
  • Organize your game into scenes and classes and build upon the iOS directory structure
  • Create and design the user interface utilizing the Sparrow API
  • Apply basic artificial intelligence to enemy objects to enhance the difficulty level of the game
  • Add finishing touches to your game with music and sound effects
  • Downloading the example code for this book. You can download the example code files for all Packt books you have purchased from your account at http://www.PacktPub.com. If you purchased this book elsewhere, you can visit http://www.PacktPub.com/support and register to have the files e-mailed directly to you.

    Table of Contents

    1. Sparrow iOS Game Framework Beginner's Guide
      1. Table of Contents
      2. Sparrow iOS Game Framework Beginner's Guide
      3. Credits
      4. About the Author
      5. About the Reviewers
      6. www.PacktPub.com
        1. Support files, eBooks, discount offers, and more
          1. Why subscribe?
          2. Free access for Packt account holders
      7. Preface
        1. What this book covers
        2. What you need for this book
        3. Who this book is for
        4. Conventions
        5. Time for action – heading
          1. What just happened?
          2. Pop quiz – heading
          3. Have a go hero – heading
        6. Reader feedback
        7. Customer support
          1. Downloading the example code
          2. Errata
          3. Piracy
          4. Questions
      8. 1. Getting Started with Sparrow
        1. Understanding the basics of Sparrow
        2. System requirements
        3. Setting up the Apple developer account
        4. Downloading Xcode
        5. Downloading Sparrow
          1. Cloning the Git repository
        6. Contents of the Sparrow package
          1. The samples folder
          2. The sparrow folder
          3. Markdown files in the root folder
          4. License
        7. Setting up Sparrow
          1. Option 1 – source tree reference
        8. Time for action – adding Sparrow as a source tree reference
          1. What just happened?
        9. Time for action – using the barebone project as a template
          1. What just happened?
          2. Option 2 – CocoaPods
        10. Time for action – installing command-line tools
          1. What just happened?
        11. Time for action – installing CocoaPods
          1. What just happened?
        12. Time for action – using the barebone project as a template
          1. What just happened?
        13. Running the template on the actual device
        14. Time for action – running the template on the actual device
          1. What just happened?
        15. Getting Sparrow documentation files
        16. Time for action – adding the Sparrow API documentation to Xcode
          1. What just happened?
        17. The idea for the game
          1. Setting goals and expectations
          2. Examining our gameplay elements
        18. Code conventions
          1. Pop quiz
        19. Summary
      9. 2. Displaying Our First Objects
        1. Understanding display objects
          1. Explaining display object containers
        2. Setting the background color
        3. Time for action – changing the background color
          1. What just happened?
          2. What is a stage?
        4. Creating our cardboard puppet doll
        5. Time for action – creating a cardboard puppet doll
          1. What just happened?
          2. Have a go hero – improving the cardboard puppet doll
        6. Explaining macros
          1. The Angles macro
          2. The Colors macro
          3. The utility functions
          4. Constants in Sparrow
            1. Math
            2. Color
        7. Manipulating display objects
        8. Time for action – manipulating display objects
          1. What just happened?
          2. Pop quiz
        9. Summary
      10. 3. Managing Assets and Scenes
        1. Working with assets
        2. Managing our assets
        3. Time for action – creating a base class
          1. What just happened?
          2. Have a go hero
        4. Creating a texture manager
        5. Time for action – managing our textures
          1. What just happened?
        6. Creating a sound manager
        7. Time for action – implementing a sound manager
          1. What just happened?
        8. Creating a file manager
        9. Time for action – managing remaining file types
          1. What just happened?
          2. Have a go hero
          3. Basic error handling
        10. Time for action – getting started with basic error handling
          1. What just happened?
          2. Have a go hero
        11. Putting it all together
        12. Time for action – creating an asset container class
          1. What just happened?
        13. Time for action – displaying an image
          1. What just happened?
          2. Have a go hero
        14. What are scenes?
        15. Time for action – implementing a scene class
          1. What just happened?
        16. Creating a scene director
        17. Time for action – managing our scenes with a scene director
          1. What just happened?
          2. Have a go hero
          3. Pop quiz
        18. Summary
      11. 4. The Basics of Our Game
        1. Taking care of cross-device compatibility
          1. Understanding the texture size limit
          2. How to deal with different screen sizes
            1. Scaling the viewport
            2. Black borders
            3. Showing non-interactive screen space
            4. Rearranging screen elements
            5. Choosing the best option
          3. Differences between various devices
          4. Utilizing the iOS SDK
          5. Retina and iPad support in Sparrow
          6. App icons and splash images
          7. The bottom line
        2. Starting with the development of our game
        3. Creating our scene manager setup
        4. Time for action – creating our scene manager setup
          1. What just happened?
        5. Adding images to the battlefield scene
        6. Time for action – adding images to the battlefield scene
          1. What just happened?
        7. Arranging images in the pirate cove scene
        8. Time for action – arranging images in the pirate cove scene
          1. What just happened?
          2. Pop quiz
        9. Summary
      12. 5. Beautifying Our Game
        1. Working with tweens
        2. Time for action – moving the pirate ship
          1. What just happened?
          2. Understanding transitions
          3. Explaining jugglers
          4. Updating the movement and canceling tweens
        3. Time for action – updating the movement
          1. What just happened?
        4. Working with sprite sheets
        5. Learning about texture formats
          1. Using TexturePacker to create sprite sheets
          2. Loading our first texture atlas
        6. Time for action – loading our first texture atlas
          1. What just happened?
          2. Pop quiz
        7. Summary
      13. 6. Adding Game Logic
        1. Extending the asset manager
        2. Time for action – adding texture atlases to the asset manager
          1. What just happened?
        3. Structuring our ships
        4. Time for action – creating a ship class
          1. What just happened?
        5. Extending the ship class
        6. Time for action – adding more functionality to the ship class
          1. What just happened?
        7. Shooting cannonballs
        8. Time for action – allowing the ship to shoot cannonballs
          1. What just happened?
          2. Have a go hero
        9. Collision detection
        10. Time for action – letting cannonballs collide with ships
          1. What just happened?
        11. Loading gameplay-relevant data
        12. Time for action – avoiding hardcoded values
          1. What just happened?
          2. Pop quiz
        13. Summary
      14. 7. User Interface
        1. Displaying the hit points of each ship
        2. Time for action – placing a health bar on top of each ship
          1. What just happened?
        3. Adding buttons to the screen
          1. Pausing and resuming the game
            1. Displaying the pause and resume buttons on the screen
        4. Time for action – putting buttons on the screen
          1. What just happened?
            1. Implementing the logic to pause and resume the game
        5. Time for action – allowing the player to pause and resume
          1. What just happened?
          2. Have a go hero
          3. Aborting the current game
        6. Time for action – conceding the game
          1. What just happened?
        7. Adding dialogs to the screen
        8. Time for action – creating a dialog class
          1. What just happened?
          2. Have a go hero
        9. Adding custom events to the dialogs
        10. Time for action – adding our own buttons to our dialog
          1. What just happened?
        11. Drawing text on the screen
          1. Displaying our first text field
        12. Time for action – adding a text field to the dialog
          1. What just happened?
          2. Explaining system fonts
          3. Explaining bitmap fonts
          4. Creating our very own bitmap font
        13. Time for action – using bmGlyph to create a bitmap font
          1. What just happened?
          2. Displaying a text field with bitmap fonts
        14. Time for action – using our bitmap font for a text field
          1. What just happened?
          2. Pop quiz
        15. Summary
      15. 8. Artificial Intelligence and Game Progression
        1. Artificial intelligence in theory
          1. Explaining fuzzy logic
          2. Explaining state machines
        2. Letting the enemy ship move and attack
          1. Moving the ship
        3. Time for action – getting the enemy ship to move around
          1. What just happened?
          2. Attacking other ships
        4. Time for action – the enemy should attack the player
          1. What just happened?
          2. Adding fuzzy values to the AI
        5. Time for action – spicing up the AI with fuzzy values
          1. What just happened?
          2. Have a go hero
        6. Adding progression to our game
          1. Adding a World class
        7. Time for action – adding a World class
          1. What just happened?
          2. Have a go hero
          3. Updating the scene and dialog classes
        8. Time for action – updating the scene and dialog classes
          1. What just happened?
          2. Adding game mechanics to the pirate cove
        9. Time for action – making the pirate cove playable
          1. What just happened?
          2. Adding progression to the game
          3. Have a go hero –turning our game into a real game
        10. Adding win and lose conditions
        11. Time for action – being able to win or lose
          1. What just happened?
          2. Pop quiz
        12. Summary
      16. 9. Adding Audio to Our Game
        1. Finding music and sound
          1. Generating sound effects
          2. Learning about audio formats
          3. Music and sound effects for our game
        2. Adding audio playback
          1. Starting the audio engine
        3. Time for action – getting audio files to play
          1. What just happened?
          2. Have a go hero
          3. Playing music in our scenes
        4. Time for action – playing music in our scenes
          1. What just happened?
          2. Have a go hero
          3. Adding a sound effect
        5. Time for action – sound effects in the pirate cove
          1. What just happened?
          2. Have a go hero
          3. Pop quiz
        6. Summary
      17. 10. Polishing Our Game
        1. Adding additional scenes
          1. The game over scene
            1. Creating the game over scene
        2. Time for action – showing the game over scene
          1. What just happened?
            1. Connecting the game over scene
        3. Time for action – having the game over scene show up
          1. What just happened?
          2. Adding a main menu
        4. Time for action – integrating the main menu into our game
          1. What just happened?
          2. Have a go hero
          3. Adding an intro scene
        5. Time for action – creating an intro for our game
          1. What just happened?
        6. Implementing tutorial mechanics
        7. Time for action – adding a tutorial to our intro scene
          1. What just happened?
        8. Loading and saving the current state
        9. Time for action – loading and saving the last played game
          1. What just happened?
          2. Pop quiz
        10. Summary
      18. 11. Integrating Third-party Services
        1. Getting word out to potential testers
          1. Registering at Ubertesters
            1. Integrating Ubertesters
        2. Time for action – integrating Ubertesters
          1. What just happened?
            1. Creating a build for beta testers
        3. Time for action – creating a build for beta testers
          1. What just happened?
            1. Deploying an application
        4. Time for action – deploying an application
          1. What just happened?
        5. Explaining Game Center
          1. Integrating Game Center authentication
        6. Time for action – integrating Game Center authentication
          1. What just happened?
          2. Have a go hero
        7. An overview of analytics services
          1. Flurry analytics
          2. Flox
          3. Pop quiz
        8. Summary
      19. A. Pop Quiz Answers
        1. Chapter 1, Getting Started with Sparrow
          1. Pop quiz
        2. Chapter 2, Displaying Our First Objects
          1. Pop quiz
        3. Chapter 3, Managing Assets and Scenes
          1. Pop quiz
        4. Chapter 4, The Basics of Our Game
          1. Pop quiz
        5. Chapter 5, Beautifying Our Game
          1. Pop quiz
        6. Chapter 6, Adding Game Logic
          1. Pop quiz
        7. Chapter 7, User Interface
          1. Pop quiz
        8. Chapter 8, Artificial Intelligence and Game Progression
          1. Pop quiz
        9. Chapter 9, Adding Audio to Our Game
          1. Pop quiz
        10. Chapter 10, Polishing Our Game
          1. Pop quiz
        11. Chapter 11, Integrating Third-party Services
          1. Pop quiz
      20. Afterword
      21. Index