Book Image

Sparrow iOS Game Framework Beginner's Guide

By : Johannes Stein
Book Image

Sparrow iOS Game Framework Beginner's Guide

By: Johannes Stein

Overview of this book

Table of Contents (20 chapters)
Sparrow iOS Game Framework Beginner's Guide
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
Afterword
Index

Time for action – creating a base class


To create a base class to manage our assets, we need to use the following steps:

  1. Open the Xcode game template if it's not already open, right-click on the Classes folder, select New Group, and rename the group to Assets.

  2. Right-click on the Assets group and select New File....

  3. Select Objective-C class and click on Next.

  4. Enter AssetsDictionary in the name field, select NSObject from the Subclass of entry, and click on Next.

  5. On the next dialog, click on Create.

  6. Open the AssetsDictionary.h file.

  7. Add an instance variable called _dict, which is a pointer to NSMutableDictionary, as shown in the following code:

    @interface AssetsDictionary : NSObject {
        NSMutableDictionary *_dict;
    }
  8. Add a property called verbose, which is of type BOOL, as shown in the following code:

    @property BOOL verbose;
  9. Add an instance method called registerAsset, as shown in the following code:

    -(id) registerAsset:(NSString *)name withContent:(id)content;
  10. Add another instance method called unregisterAsset...