From 34579ad6ecb698e9b7f5c7d502d90eb656e09beb Mon Sep 17 00:00:00 2001 From: dingpinglv Date: Sun, 9 Jun 2013 15:35:46 +0800 Subject: [PATCH] fixed #2144 fixed a bug of cc.ParticleSystem that the _totalParticles is wrong on canvas mode. --- cocos2d/particle_nodes/CCParticleSystem.js | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/cocos2d/particle_nodes/CCParticleSystem.js b/cocos2d/particle_nodes/CCParticleSystem.js index 7e2972018a..9db9f4e6f6 100644 --- a/cocos2d/particle_nodes/CCParticleSystem.js +++ b/cocos2d/particle_nodes/CCParticleSystem.js @@ -1404,7 +1404,6 @@ cc.ParticleSystem = cc.Node.extend(/** @lends cc.ParticleSystem# */{ this.setTexture(canvasObj); else this.setTexture(addTexture); - } } @@ -1480,8 +1479,13 @@ cc.ParticleSystem = cc.Node.extend(/** @lends cc.ParticleSystem# */{ addParticle:function () { if (this.isFull()) return false; - - var particle =this._particles[this._particleCount]; + var particle, particles = this._particles; + if(cc.renderContextType === cc.CANVAS && this._particleCount < particles.length){ + particle =particles[this._particleCount]; + }else{ + particle = new cc.Particle(); + particles.push(particle); + } this.initParticle(particle); ++this._particleCount; return true;