I have 4 images and a background. I already about to animate the image to move accordingly. But the back ground is not moving. I am not sure how to make the background move accordingly to the movement of the images. Because each of the images moves differently.
this is first image move:
- (void)loadIllustration1
{
Sprite *illustration1 = [Sprite spriteWithFile:@"livraison01.png"];
[illustration1 setTag:kTagIllustration1];
//illustration1.position = CGPointMake(540,-40);
illustration1.position = CGPointMake(540,-40);
illustration1.scale =1.14;
id fade = [FadeIn actionWithDuration:1];
//id go = [MoveTo actionWithDuration:2 position:CGPointMake(10,-10)];
id go = [MoveTo actionWithDuration:2 position:CGPointMake(10,-10)];
id seq = [Sequence actions: fade ,go , nil];
[illustration1 runAction:seq];
[self addChild:illustration1];
[NSTimer scheduledTimerWithTimeInterval:3.8 target:self selector:@selector(finishIllustrationAnimation1) userInfo:nil repeats:NO];
}
this is second image:
- (void)loadIllustration2
{
Sprite *illustration1 = (Sprite *)[self getChildByTag:kTagIllustration1];
if (illustration1 != nil) [self removeChildByTag:kTagIllustration1 cleanup:YES];
Sprite *illustration2 = [Sprite spriteWithFile:@"livraison02.png"];
[illustration2 setTag:kTagIllustration2];
illustration2.scale = 0.9;
//illustration2.position = CGPointMake(460,135);
//this will show the image from down right to up left
illustration2.position = CGPointMake(30,240);
id fade = [FadeIn actionWithDuration:1];
//id go = [MoveTo actionWithDuration:2 position:CGPointMake(20,305)];
//this will show the image from down right to up left
id go = [MoveTo actionWithDuration:2 position:CGPointMake(400,30)];
id seq = [Sequence actions: fade ,go , nil];
[illustration2 runAction:seq];
[self addChild:illustration2];
[NSTimer scheduledTimerWithTimeInterval:3.8 target:self selector:@selector(finishIllustrationAnimation2) userInfo:nil repeats:NO];
}
this is the initializer of the background
- (id)init
{
if (self = [super init])
{
Sprite *background = [Sprite spriteWithFile:@"background.png"];
background.position = CGPointMake(240,160);
[background runAction:[FadeIn actionWithDuration:1]];
[self addChild:background];
self.reader = [[BubbleReader alloc] initWithPlistFile:@"BubbleItems.plist"] ;
currentIllustration = kTagIllustration1;
[self loadIllustration];
}
return self;
}
I appricate anyone's help