1

I have an error on Xamarin And CocosSharp (CocosSharp PCL), when I am loading Sprite Sheets the app Closes without error, the code loads around 46 spriteSheets of one animation, in the second animation load at index 5 the apps closes, I have detected the line where the app closes. here is my code:

spriteSheet = new CCSpriteSheet(File);

class AnimatedSprite : Sprite
{

CCAnimation animation;
CCRepeatForever Repeat;
        List<Resource> ImageList;

    CCSpriteSheet spriteSheet;
    public AnimatedSprite(AnimatedSpriteTemplate template)
        : base(template.Folder + template.Screen_Resolution + "/" + template.Image_Prefix + template.Screen_Resolution + template.Image_NumberSubfix + "_00000" + template.Image_Subfix, template.Name, template.Section)
    {
        //animation = new CCAnimation();

        List<CCSpriteFrame> animationFrames = new List<CCSpriteFrame>();

        try
        {
            ImageList = new List<Resource>();
            for (int i = 0; i < template.ImagesCount; i += 1)
            {
                string File = template.Folder + template.Screen_Resolution + "/" + template.Image_Prefix + template.Image_NumberSubfix;

                File += i;

                File += template.Image_Subfix;

                spriteSheet = new CCSpriteSheet(File); //<--------- Here is the line

                spriteSheet.Frames.ForEach(animationFrames.Add);

                //**********************************************
                LoadingScreen.LoadCount += 1;
                //**********************************************

            }

            animation = new CCAnimation(animationFrames, 0.04f);
            Repeat = new CCRepeatForever(new CCAnimate(animation));
            cCSprite = new CCSprite(animationFrames.First()) { Name = template.Name };
            //cCSprite.AddAction(Repeat);
        }
        catch(Exception ex)
        {
            System.Console.Write("MSPGSOFT:" + ex.Message);
        }
    }
}

I have to develop a game based 100% on animated sprites, so i really need any help, thank you all from now

Brandon Minnick
  • 13,342
  • 15
  • 65
  • 123

1 Answers1

1

Ok,

After researching I realized there's too much textures to load, so I decided to use TexturePacker, wich packed over 600 textures into 20 Textures, the error was the gpu returned out of memory. currently the app works