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 cardboard puppet doll


To create the cardboard puppet doll, we need to perform the following steps:

  1. Open the Game.m file if it's not already open.

  2. Add a body container with the following lines:

    SPSprite *body = [[SPSprite alloc] init];
    body.x = 85;
    body.y = 120;
            
    [self addChild:body];
  3. Add torso as shown in the following code:

    SPQuad *torso = [SPQuad quadWithWidth:150 height:150];
    torso.color = 0xff0000;
            
    [body addChild:torso];
  4. Now add a local variable head as shown in the following code:

    SPQuad *head = [SPQuad quadWithWidth:80 height:80 color:SP_YELLOW];
    head.x = 35;
    head.y = -70;
    
    [body addChild: head];
  5. Add a container for the arms local variable as shown in the following code:

    SPSprite *arms = [[SPSprite alloc] init];
    
    [body addChild:arms];
  6. Add a container for the legs local variable as shown in the following code:

    SPSprite *legs = [[SPSprite alloc] init];
    legs.y = 140;
    
    [body addChild:legs];
  7. Add the left arm as shown in the following code:

    SPQuad *leftArm...