Search code examples
cocos2d-iphoneparticles

Proper implementation of Particle Designer plist emitters in cocos2d?


I'm confused about how to properly use emitters made in Particle Designer with Retina displays in cocos2d. I have tried using an emitter with a non-hd texture (fire.png for example) saved as "particle.plist" with and without the texture embedded and I get a warning of some kind either way. I then made another emitter with fire-hd.png and the name "particle-hd.plist", and I get the same types of warnings, stuff like, cocos2d: Filename(fire-hd.png) contains -hd suffix. Removing it. See cocos2d issue #1040

Searching for issue #1040 yields a little info, but not enough for me to fix this.

A little enlightenment?


Solution

  • You need to prepare these files.

    • particle.plist (it uses texture 'fire.png' with or without the texture embedded)
    • fire-hd.png

    CCParticleSystem searches -hd texture file first, then non-hd texture file, and then embedded texture data.

    EDIT

    "Warning HD file not found" for Particle plist is false warning. You can use CCParticleSystem initWithDictionary method without any warning in this case.

    NSString *path = [[NSBundle mainBundle]
        pathForResource:@"particle1_traile" ofType:@"plist"];
    NSDictionary *dict = [NSDictionary dictionaryWithContentsOfFile:path];
    CCParticleSystem *particle = [[[CCParticleSystemQuad alloc]
        initWithDictionary:dict] autorelease];