If i an action moves the sprite,how can i keep the CCSprite on the screen???? this is my code:
[enemy runAction:[CCSequence actions:[CCMoveBy actionWithDuration:2.0 position:ccp(-winSize.width*0.4, 0)],
[CCMoveBy actionWithDuration:randomValueBetween(1.0, 0.3)
position:ccp(randomValueBetween(winSize.width*0.2, -winSize.width*0.2),
randomValueBetween(winSize.height*0.2, -winSize.height*0.2))],
[CCDelayTime actionWithDuration:0.5],
[CCMoveBy actionWithDuration:randomValueBetween(1.0, 0.3)
position:ccp(randomValueBetween(winSize.width*0.2, -winSize.width*0.2),
randomValueBetween(winSize.height*0.2, -winSize.height*0.2))],
[CCDelayTime actionWithDuration:0.5],
[CCMoveBy actionWithDuration:randomValueBetween(1.0, 0.3)
position:ccp(randomValueBetween(winSize.width*0.2, -winSize.width*0.2),
randomValueBetween(winSize.height*0.2, -winSize.height*0.2))],
[CCDelayTime actionWithDuration:0.5],
[CCMoveBy actionWithDuration:randomValueBetween(1.0, 0.3)
position:ccp(randomValueBetween(winSize.width*0.2, -winSize.width*0.2),
randomValueBetween(winSize.height*0.2, -winSize.height*0.2))],
[CCDelayTime actionWithDuration:0.5],
[CCMoveBy actionWithDuration:randomValueBetween(1.0, 0.3)
position:ccp(randomValueBetween(winSize.width*0.2, -winSize.width*0.2),
randomValueBetween(winSize.height*0.2, -winSize.height*0.2))],
[CCDelayTime actionWithDuration:0.5],
[CCMoveBy actionWithDuration:randomValueBetween(1.0, 0.3)
position:ccp(randomValueBetween(-winSize.width*0.3,winSize.width*0.3),
randomValueBetween(winSize.height*0.3, -winSize.height*0.3))],
[CCDelayTime actionWithDuration:0.5],
[CCMoveBy actionWithDuration:randomValueBetween(1.0, 0.3)
position:ccp(randomValueBetween(-winSize.width*0.2,winSize.width*0.2),
randomValueBetween(winSize.height*0.2, -winSize.height*0.2))],
[CCDelayTime actionWithDuration:0.5],
[CCMoveBy actionWithDuration:randomValueBetween(1.0, 0.3)
position:ccp(randomValueBetween(-winSize.width*0.3,winSize.width*0.3),
randomValueBetween(winSize.height*0.3, -winSize.height*0.3))],
[CCDelayTime actionWithDuration:0.5],
[CCMoveBy actionWithDuration:randomValueBetween(1.0, 0.3)
position:ccp(randomValueBetween(-winSize.width*0.2,winSize.width*0.2),
randomValueBetween(winSize.height*0.2, -winSize.height*0.2))],
[CCDelayTime actionWithDuration:0.5],
[CCMoveBy actionWithDuration:randomValueBetween(1.0, 0.3)
position:ccp(randomValueBetween(-winSize.width*0.3,winSize.width*0.3),
randomValueBetween(winSize.height*0.3, -winSize.height*0.3))],
[CCDelayTime actionWithDuration:0.5],
[CCMoveBy actionWithDuration:randomValueBetween(1.0, 0.3)
position:ccp(randomValueBetween(-winSize.width*0.2,winSize.width*0.2),
randomValueBetween(winSize.height*0.2, -winSize.height*0.2))],
[CCDelayTime actionWithDuration:0.5],
[CCMoveBy actionWithDuration:2.0 position:ccp(-winSize.width*1.5, 0)],
[CCCallFuncN actionWithTarget:self selector:@selector(invisNode:)], nil]];
but whit this code the sprite sometimes comes out the screen, i need the sprite moves randomly in the screen without comes out..