Time for action – creating a cardboard puppet doll
To create the cardboard puppet doll, we need to perform the following steps:
- Open the
Game.m
file if it's not already open. - Add a
body
container with the following lines:SPSprite *body = [[SPSprite alloc] init]; body.x = 85; body.y = 120; [self addChild:body];
- Add
torso
as shown in the following code:SPQuad *torso = [SPQuad quadWithWidth:150 height:150]; torso.color = 0xff0000; [body addChild:torso];
- 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];
- Add a container for the
arms
local variable as shown in the following code:SPSprite *arms = [[SPSprite alloc] init]; [body addChild:arms];
- 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];
- Add the left arm as shown in the following code:
SPQuad...