Particle Effect Help?

Particle Effect Help?
0.0 0


I just recently upgraded to Xcode 4 and have been using Cocos2d-x 0.8.5. Everything was working fine, well at least it seemed like it was in Xcode 3, now my Particle effect is hitting an assert at:

Here is my code, what am I doing wrong:

CCParticleSystem* emitter;

// Setup key emitter
item.emitter = CCParticleExplosion::node();
//item.emitter = new CCParticleExplosion;
item.emitter->initWithTotalParticles(5); — Crashes in here!

I get this assert:
#if COCOS2D_DEBUG >= 1
tHashUpdateEntry *pHashElement = NULL;
HASH_FIND_INT(m_pHashForUpdates, &pTarget, pHashElement);
assert(pHashElement NULL);

Assertion failed: (pHashElement NULL), function scheduleUpdateForTarget, file /Mikes/iTouchDev/Projects/Cannon/CannonBallBounce/CannonBallBounce/libs/cocos2dx/CCScheduler.cpp, line 492.

What is going on? In release it doesn’t assert, but that is because of the COCOS2D_DEBUG define isn’t defined, but now I feel like I am doing something wrong in release. Am I not using the particle system correctly?

Thanks in advance.


I think I got it fixed.

It seems like I was initializing it twice with the ::node() and the initwithTotalParticles call. I removed the initWithTotalParticles call and replaced that with the setter function for Total Particles and everything works fine.