Skip to content

Commit af88c1a

Browse files
author
SeanLin
committed
Merge pull request cocos2d#967 from dingpinglv/Iss2144_FixBugForParticleSystem
fixed cocos2d#2144 fixed a bug of cc.ParticleSystem that the _totalParticles is wrong on canvas mode.
2 parents 9ac32af + 5aa7dd8 commit af88c1a

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

cocos2d/particle_nodes/CCParticleSystem.js

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1404,7 +1404,6 @@ cc.ParticleSystem = cc.Node.extend(/** @lends cc.ParticleSystem# */{
14041404
this.setTexture(canvasObj);
14051405
else
14061406
this.setTexture(addTexture);
1407-
14081407
}
14091408
}
14101409

@@ -1480,8 +1479,13 @@ cc.ParticleSystem = cc.Node.extend(/** @lends cc.ParticleSystem# */{
14801479
addParticle:function () {
14811480
if (this.isFull())
14821481
return false;
1483-
1484-
var particle =this._particles[this._particleCount];
1482+
var particle, particles = this._particles;
1483+
if(cc.renderContextType === cc.CANVAS && this._particleCount < particles.length){
1484+
particle =particles[this._particleCount];
1485+
}else{
1486+
particle = new cc.Particle();
1487+
particles.push(particle);
1488+
}
14851489
this.initParticle(particle);
14861490
++this._particleCount;
14871491
return true;

0 commit comments

Comments
 (0)