I have a method which sets up CCAnimation's for me
public CCAnimation SetupAnimations(string prefixOFSprite, int numberOfFrames, int startFrame)
{
//me getting desperate and doing any old initilisation
CCAnimation finalAnimation = new CCAnimation();
finalAnimation = CCAnimation.animation();
for (int i = startFrame; i < numberOfFrames + 1; i++)
{
finalAnimation.addFrameWithFileName(prefixOFSprite + "-" + i);
}
float delay = 0.07f;
finalAnimation.setDelay(delay);
return finalAnimation;
Which I call like this
whiteDogBeginFalling = SetupAnimations("GameGraphics/dog/falling/white-falling", 7, 1)
But the animations don't play when I run the game :( This is me porting my game from iOS, and I got round this problem by adding
[whiteDogBeginFalling retain]
straight after the method call.
How do you do this in the C# version of cocos2d? Or can anyone help me come up with another solution?
Thanks in advance