O'Reilly logo

Sparrow iOS Game Framework Beginner's Guide by Johannes Stein

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

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]; ...

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

Start Free Trial

No credit card required