O'Reilly logo

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Learning Objective-C by Developing iPhone Games

Book Description

Leverage Xcode and Objective-C to develop iPad and iPhone games

In Detail

The introduction of the Apple Store has empowered thousands, even millions of people to embrace software development. Using Objective-C and the Xcode IDE, you can produce awesome games and launch them on the Apple Store allowing you to make and sell games quickly and easily.

From learning the basics of Objective-C to deploying to the App Store, you'll use this book to learn about game development in a matter-of-fact, helpful manner. Whether you're new to game development, or just want to learn how to leverage Apple's own tools to expand your skill set, you'll quickly move from a beginner to an expert.

The book kicks off with the basics of game development, and you will take your first steps with using Xcode, the official Apple programming IDE, before moving on to the most important concepts involved in programming games using Objective-C. This book is a hands-on guide to developing the game of your dreams in no time for the Apple Store.

What You Will Learn

  • Understand the basics of Objective-C and develop code in the iOS language
  • Set up multiple screens in iOS and make easy transitions from one screen to another
  • Create a simple audio-based memory game using basic game logic
  • Display a background image for your game and program your aliens to drop bombs
  • Build a simple user interface using Xcode's interface builder
  • Program your graphics to move using buttons, gestures, and multitouch interactivity
  • Overcome common issues that developers run in to at one point or another
  • Explore the Apple Store and iTunes Connect's submission process and prepare your app for distribution

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. Learning Objective-C by Developing iPhone Games
    1. Table of Contents
    2. Learning Objective-C by Developing iPhone Games
    3. Credits
    4. About the Authors
    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. Reader feedback
      6. Customer support
        1. Downloading the example code
        2. Errata
        3. Piracy
        4. Questions
    8. 1. The Environment – Installing and Working with Xcode
      1. Becoming an Apple developer
        1. Registering as an Apple developer
      2. Becoming an iOS developer
        1. Registering as an iOS developer
      3. Downloading and installing Xcode
      4. The Xcode IDE
        1. Opening Xcode for the first time
      5. The Xcode workspace
        1. The toolbar
          1. The Run button
          2. The Stop button
          3. The Scheme pop-up menu
          4. The Activity viewer
          5. The Editor buttons
          6. The View buttons
        2. The Navigation area
        3. The Editor area
        4. The Debugger area
        5. The Utility area
      6. The iOS Simulator
      7. Summary
    9. 2. Programming and Objective-C
      1. Understanding Objective-C
      2. Programming basics
        1. Basic data types
          1. Text data types
          2. Numeric data types
          3. Other data types
        2. Variables
        3. Constants
        5. Operators
          1. Arithmetic operators
          2. Comparison operators
          3. Logical operators
          4. Increment and decrement operators
          5. Compound operators
        6. Control statements
          1. The if statement
          2. The if…else statement
          3. The if…else if statement
          4. The switch statement
        7. Loops
          1. The for loop
          2. The while loop
          3. The do while loop
          4. The break statement
          5. The continue statement
        8. Functions
        9. Variable scope
      3. Object-oriented programming
        1. Objects
        2. Classes
        3. Methods
        4. Pointers
        5. Objective-C data types
          1. NSString
          2. NSMutableString
          3. NSNumber
          4. NSSet
          5. NSMutableSet
          6. NSArray
          7. NSMutableArray
      4. Hello World!
      5. Programming with Objective-C
        1. @interface
        2. @implementation
      6. Model-view-controller
      7. Summary
    10. 3. iPhone Game Development Basics – The Matching Game
      1. Scenes and views
        1. Understanding storyboards
        2. The memory game code
        3. Frameworks
        4. Building our game scene
      2. Summary
    11. 4. Drawing Pictures – Space Invaders
      1. Understanding screens and graphics
      2. Adding graphics programmatically
      3. Moving our ship sprite
      4. Creating our enemies
      5. Using a sprite sheet
      6. Creating the enemy bombs
      7. Summary
    12. 5. The Game Engine – Space Invaders Part 2
      1. Understanding the game logic
      2. Understanding state machines
      3. Learning the game state
      4. Collision detection
      5. Timers and frame rates
      6. Debugging your code
      7. Summary
    13. 6. The Audio Engine – The Simon Memory Game
      1. Introduction to audio
      2. File formats
        1. Bit rates
        2. Sample rates
      3. Data formats
      4. The Simon Says game
      5. Summary
    14. 7. User Interactivity – Mini Golf
      1. Using user input and touch events
      2. Using gestures in iOS apps
      3. Using touch start, move, and end
        1. Initializing our code
        2. Touch events
        3. Updating the screen
      4. Using other mechanisms
        1. Shake
        2. Orientation
        3. Tilt
        4. Motion
      5. Summary
    15. 8. The Galaxy Game
      1. Planning the game
        1. Creating the game concept document
        2. Creating the game design document
        3. Creating the technical design document
      2. Considering the design and flow
      3. Focusing on resource management
      4. Creating game screens
      5. Building the user interface
      6. Setting up the gameplay environment
      7. Creating and controlling the player
      8. Creating and controlling the enemies
      9. Collision detection
      10. Adding sounds
      11. Summary
    16. 9. Releasing Your Game
      1. Preparing your app for distribution
      2. Selecting your identity
        1. The bundle identifier
        2. The version number and build string
        3. Team
      3. The deployment information
        1. The deployment target
        2. Devices
        3. The device orientation
        4. The status bar style
      4. Selecting app icons and launch images
        1. Linked frameworks and libraries
      5. Beta testing and ad hoc distribution
        1. Register all test devices
        2. App ID
        3. Ad hoc provisioning profile
        4. Archive and create your app package
        5. Installing on test devices
        6. iTunes Connect app
      6. Avoiding rejection from the App Store
      7. Summary
    17. 10. Conclusion
      1. Developing an app for iPad
      2. Using Apple's game center
      3. In-app purchasing
      4. Implementing iAd
      5. The social framework
      6. Core Location and Map Kit
      7. Saving space with iCloud
      8. Exploring game engines
      9. Summary
    18. Index