I use the method [stopSystem]
how to restart the particleSystem ??
how to restart a particleSystem
(5 posts) (5 voices)-
Posted 2 years ago #
-
there's a restart method aswell if I'm not mistaken.
~ Natanavra.
Posted 2 years ago # -
Beacause I keep my particle systems around, and because I want to start and stop the emitter routinely without destroying any existing particles that may have already been emitted, I added the following two methods to my particle classes.
-(void)enable
{
active = YES;
elapsed = 0.0f;
}-(void)disable
{
active = NO;
}We should push for getting something like this in the mainline so that we don't have to stay delta'd away from it.
- Jason
Posted 2 years ago # -
definitely submit it as an enhancement if it works and is simple... but if you want to just add it to all the existing particlesystems without needing to mod the Cocos2d source, you can add it as an objective c "category", which basically means just define your new methods, and and add them to the class like so:
MyNewFeatures.h: @interface ParticleSystem (myNewFeatures) -(void)enable; -(void)disable; @end MyNewFeatures.m: @implementation ParticleSystem (myNewFeatures) -(void)enable { active = YES; elapsed = 0.0f; } -(void)disable { active = NO; } @endThen include "MyNewFeatures.h" in any place you want to use your new methods, and they'll work... The only thing categories can't do is add new member variables, but since you wanted to work with existing member variables, you're good!
Posted 2 years ago # -
setting the active yes/no not working.
Property is readOnly/** Is the emitter active */ @property (nonatomic,readonly) BOOL active;Posted 1 year ago #
Reply
You must log in to post.