How To Implement Particle Designer?

Forums Programming cocos2d support (graphics engine) How To Implement Particle Designer?

This topic contains 7 replies, has 4 voices, and was last updated by  dell 3 years, 9 months ago.

Viewing 8 posts - 1 through 8 (of 8 total)
Author Posts
Author Posts
July 9, 2010 at 10:01 am #223080

dell
Participant
@dell

Hi I love the new particle designer and it basically sends out either a plist and png or plist with embedded graphic for use in Cocos2d. However there is not much information on how to implement this. So I throw myself on the mercy of the court, errr I mean the mercy of the forum users for some direction:

I am using Particle Designer 1.2 (Which I bought!) and Cocos2d-iphone-0.99.4-rc3

I am able to get a regular particle emitter without using Particle Designer in CoCos2d to work… but when I try and use ParticleDesigner plists I get this on build and run in the simulator: “terminate called after throwing an instance of ‘NSException’”

I create the pList and the PNG for CoCos2D from the designer as it shows in the video tutorial on vimeo. They are named super.png and super.plist I then copy them into the resources directory of the project.

Here is my code:

In .h I have:

@interface HelloWorld : CCLayer

{

CCQuadParticleSystem *emitter;

}

In .m I have:

emitter = [[CCQuadParticleSystem alloc] init];

emitter.position = ccp(240, 460);

emitter = [[CCQuadParticleSystem alloc] initWithFile:@”super.plist”];

[self addChild: emitter z:10];

I also followed the Video tutorial on Vimeo and looked in the included ParticleTest included in 99.rc3

I tried to change .m to this

emitter = [[CCQuadParticleSystem alloc] initWithFile:@”super.plist”];

[self addChild: emitter z:10];

Both methods blew chunks and would cause the debugger to throw up an exception error. I am sure I am missing something obvious here… Can anyone provide some advice. I am sure more than one person wants to know! Thanks in advance!

July 9, 2010 at 10:38 am #290005

robodude666
@robodude666

Added fire.png as a resource? :)

July 9, 2010 at 12:48 pm #290006

cybergreg
Participant
@cybergreg

After I made my particle and saved it using Particle Designer (v1.2, embedded image), I used this code to display it:

self.emitter = [CCQuadParticleSystem particleWithFile:@"pdLightRain.plist"];
[self addChild: emitter z:10];

Worked perfect for my testing…

July 9, 2010 at 8:30 pm #290007

dell
Participant
@dell

@ robodude666 yes thanks… @cybergreg Thanks for the tip… When I added

self.emitter = [CCQuadParticleSystem particleWithFile:@"test.plist"];
[self addChild: emitter z:10];

My plist name is test.plist with embedded image using Particle Designer 1.2 I get this

error: object cannot be set - either readonly property or no setter found

And yes my plist is added to resources properly as well… Baffled here…

July 9, 2010 at 8:48 pm #290008

dell
Participant
@dell

Ok just to make it more interesting… The code below worked fine, which is good! But when I use emitter code above it does not… Am I supposed to reference emitter in my .h file? Clearly I am missing something?

CCQuadParticleSystem *particle = [CCQuadParticleSystem particleWithFile:@"test.plist"];
[self addChild:particle];

July 9, 2010 at 9:02 pm #290009

finder39
Participant
@finder39

use what you just made, its what you want

July 9, 2010 at 9:12 pm #290010

cybergreg
Participant
@cybergreg

@dell – take a look at the ParticleTest.h &.m file in the tests section. You were missing this in your .h file:

@property (readwrite,retain) CCParticleSystem *emitter;

and then you’ll need this:

@synthesize emitter;

in your .m file

July 9, 2010 at 10:19 pm #290011

dell
Participant
@dell

@cybergreg I tried it and of course that was the missing code for getting the emitter to run. Thanks!!

@finder39 Thanks for your comment. Yes in some situations calling the particle system this way works better!

Viewing 8 posts - 1 through 8 (of 8 total)

You must be logged in to reply to this topic.