Forum Libraries, Components, and Plugins
We are excited to announce that the Xamarin Forums are moving to the new Microsoft Q&A experience. Q&A is the home for technical questions and answers at across all products at Microsoft now including Xamarin!

We encourage you to head over to Microsoft Q&A for .NET for posting new questions and get involved today.

CCParticleExplosion creates a huge performance drop

Hi,

I am building a shooter game and over here when player fires the enemy, the enemy ship must explode.
I utilized the particleExplosion implementation from Gonebananas game, but when particle explosion happens the movements on screen becomes super slow and causes entire screen to hang. I have attached my implementation below. please provide some suggestions to optimize the particle explosion

void checkCollisionofEnemy()
{

        Enemy.ForEach(enemyShip =>
        {
            bullets.ForEach(bullet =>
            {
                bool hit = bullet.BoundingBoxTransformedToParent.IntersectsRect(enemyShip.BoundingBoxTransformedToParent);
                if (hit)
                {
                    enemyShip.RemoveFromParent(true);
                    Explode(enemyShip.Position);
                }
            });

        });
    }

thanks,

Tagged:

Posts

  • IlledanIlledan NOMember ✭✭
    edited May 2016

    What is your code inside Explode?

    Tried using CCParticleExplosion without any problems:
    https://github.com/Illedan/ParticleExplosionCocossharp

    Take a look at MySpriteContainer.

  • Thanks for your suggestion.
    Removing the hit bullets and exiting the loop after collision detection of bullet instance by discarding the unnecessary iteration , resolved this bug (Like in my previous issue of collision detection).
    I highly appreciate your valuable solution.

Sign In or Register to comment.