// Define an image genie
Ccsprite * sprite = [ccsprite spritewithfile: @ "1.jpg"];
Cgsize S = [[ccdirector shareddire] winsize];
Cgpoint P = CCP (S. width/2, 50 );
// Implement various actions
[Sprite runaction: [ccmoveto actionwithduration: 1.0 position: p]; // move to the specified position
[Sprite runaction: [ccmoveby actionwithduration: 1.0 position: CCP (20, 20)]; // motion to the specified X, Y increment position
[Sprite runaction: [ccscaleby actionwithduration: 1.5 scale: 1.1]; // zoom in
[Sprite runaction: [ccrotateby actionwithduration: 1.5 angle: 60]; // rotate 60 degrees
[Sprite runaction: [cctintby actionwithduration: 1.0 RED: 200 Green: 0 Blue: 0]; // color change
// Continuous action
Id ac0 = [sprite runaction: [ccplace actionwithposition: p];
Id AC1 = [ccmoveto actionwithduration: 2 position: CCP (S. Width-50, S. Height-50)];
Id ac2 = [ccjumpto actionwithduration: 2 position: CCP (150, 50) Height: 30 jumps: 5];
Id AC3 = [ccblink actionwithduration: 2 blinks: 3];
Id ac4 = [cctintby actionwithduration: 0.5 RED: 0 Green: 255 Blue: 255];
[Sprite runaction: [ccsequence actions: ac0, AC1, ac2, AC3, ac4, nil];
// Continuous and Concurrent Actions
Sprite. Rotation = 0;
[Sprite setposition: p];
Id AC1 = [ccmoveto actionwithduration: 2 position: CCP (S. Width-50, S. Height-50)];
Id ac2 = [ccrotateto actionwithduration: 2 angle: 90];
Id AC3 = [ccscaleto actionwithduration: 1 scale: 3];
Id ac4 = [ccscaleby actionwithduration: 1 scale: 0.5];
Id seq = [ccsequence actions: Ac3, ac4, nil];
[Sprite runaction: [ccspawn actions: AC1, ac2, seq, nil];
// Repeat a series of actions n times
Sprite. Rotation = 0;
[Sprite setposition: p];
// Create a sequence
Id AC1 = [ccmoveto actionwithduration: 2 position: CCP (S. Width-50, S. Height-50)];
Id ac2 = [ccjumpby actionwithduration: 2 position: CCP (-400,-200) Height: 30 jumps: 5];
Id AC3 = [ccjumpby actionwithduration: 2 position: CCP (S. width/2, 0) Height: 20 jumps: 3];
Id seq = [ccsequence actions: AC1, ac2, AC3, nil];
// Repeat the preceding sequence for sequence 3
Times.
[Sprite runaction: [ccrepeat actionwithaction: seq times: 3];
// Reverse
Sprite. Rotation = 0;
[Sprite setposition: p];
Id AC1 = [ccmoveby actionwithduration: 2 position: CCP (190,220)];
Id ac2 = [AC1 reverse];
[Sprite runaction: [ccrepeat actionwithaction: [ccsequence actions: AC1, ac2, nil] times: 2];
// Increase the interval
Id AC1 = [ccmoveby actionwithduration: 2 position: CCP (100,100)];
Id ac2 = [AC1 reverse];
// Implement a waiting Interval
[Sprite runaction: [ccsequence actions: AC1, [ccdelaytime actionwithduration: 2], ac2, nil];