In this tutorial I am going to bind the emitter to a game agent, now you will have to forgive me as I have been very lazy, I have taken textures from the Creators Club particle example as well as some of the facing methods, have not bothered to write a new agent class, rather just derived it from the Particle2D class and it's texture I have taken from a game I was writing for this years DBP warm up challenge and never finished. BUT, having said all that I think it should give you enough to see how you can bolt the emitters into your own game agents.
Where to start, well as I want to setup and draw the emitters from my Agent, I have removed the base class from it and made it's protected methods public. In doing so I have had to add a Game object to the class, and as I wanted to have two emitters per agent, one for smoke and one for fire and one to have a larger particle than the other so introduced a baseScale. Also added a texture asset parameter to the constructor as well as the new baseScale. I have also replaced the targetPos with a Particle2D object so we can bind to the agent, this also has been added to the constructor. So save me confusing you any more, here is the class as it stands now.
Now we create our Agent class, this is derived from the Particle2D class, I add a Game object, a velocity and two ParticleEmitter2Ds, one for smoke and one for fire. A reasonably simple constructor to set the base values, a LoadContent to, well load the content, an Update method where I can code the behaviour of the agent, a Draw method and then three methods acquired from the Creators Club samples. This gives me a class that looks like this
So with that all in place I create an Agent array and in each key Game method (LoadContent,Update and Draw) I loop through my agents and call the respective method.
Now the code around the whole Agent and related emitters is not great, best thing would be to move ALL this into a single draw call, as I said at the top, I have been very lazy with this tutorial. I have not even done a 3D version, but the principles will carry over just the same.
Now what we end up with is the clip you see at the top of this post, yes that's right ROCKET SHEEP!!!
Solution project can be downloaded here.