CCSprite with actions crossing the screen boundaries (copy sprite problem)
- by iostriz
Let's say we have a CCSprite object that has an actions tied to it:
-(void) moveJack
{
CCSpriteSheet *sheet = (CCSpriteSheet*)[self getChildByTag:kSheet];
CCSprite *jack = (CCSprite*)[sheet getChildByTag:kJack];
...
CCSequence *seq = [CCSequence actions: jump1, [jump1 reverse], jump2, nil];
[jack runAction:seq];
}
If the sprite crosses over the screen boundary, I would like to display it at opposite side.
So, original sprite is half displayed on the right side (for example), and half on the left side, because it has not fully crossed yet.
Obviously (or is it), I need 2 sprites to achieve this.
One on the right side (original), and one on the left side (a copy).
The problem is - I don't know how to create exact copy of the original sprite, because tied actions have scaling and blending transformations (sprite is a bit distorted).
I would like to have something like:
CCSprite *copy = [[jack copy] autorelease];
so that I can add a copy to display it on the correct side (and kill it after transition is over).
It should have all the actions tied to it...
Any ideas?