Tutorial

Creating your first effect:

NOTE: EZFX2D comes with factory settings that will be loaded upon startup.  You can create your first effect by adjusting the properties on the Effect Settings tab. In order to obtain the desired effect you must understand how each of the properties will affect the particle emitter.

    1. Select the Effect Settings tab
    2. Expand the Texture Rollout on the Effect Settings tab
    3. Choose a texture or import a new one by clicking the "Import Texture" button
    4. Expand the Particles rollout and choose a minimum and maximum number of particles to be displayed by the emitter each time particles are added.
    5. Expand the Lifetime rollout and choose a mimum and maximum lifetime for the particles.
    6. Adjust the remianing rollouts to until the effect displays the desired result.

 

Preparing your game XNA Game Studio project to run EZFX2D:

    1. Expand the Content project hierarchy in your XNA Game Studio 3.1 project
    2. Right click on the References node and Click "Add Reference..."
    3. Click the browse tab and browse to Program files\Lucid Vision Games\EZFX2D Particle Effect Builder\EZFX.dll
    4. Locate the References node for the project that will be using the effect emitter and repeat steps 2 and 3
    5. Add a folder to the Content project that will contain your particle settings files
    6. Add a folder to the Content project that will contain the Textures for your particle settings

 

Exporting your new Effect:

    1. In EZFX2D select the Effect Settings tab
    2. Choose a the appropriate content path by clicking Content Path > Load (the content path should start with ..\\ where the ".." corresponds to the content directory
    3. Export the effect by clicking Effect > Export
    4. Choose the directory you created under the Content project that will contain your effect settings files
    5. Type a meaningful name for the setting and click save
    6. Right click on the settings folder and choose Add > Existing item
    7. Browse to the settings file and add it to the project
    8. Copy the associated effect texture to the Texture folder if it does not already exist

 

Using the Effect Emitter in XNA Game Studio:

Declare variable for an effect emitter

EZFX.EZFX2D.ParticleEmitter2D myEmitter;

 

In the LoadContent function of your game class load the settings and content as shown below:

myEmitter = new EZFX.EZFX2D.ParticleEmitter2D(Content.Load<EZFX.EZFX2D.ParticleSettings>(".\\ParticleSettingsFolder\\ParticleSettingsName"), 3, Shared.Content);

 

In the Update function of the game class add the following line:

myEmitter.Update(gametime);

 

In the Draw function of the game class add the following lines:

spriteBatch.Begin(SpriteBlendMode.Additive);

myEmitter.spriteBatch.Draw(ref spriteBatch);

spriteBatch.End();

 

To Add particles to the screen call the following line within the scope of the game classes Update function as shown below:

myEmitter.AddParticles(new Vector2(100, 100));

 

Resources:

Download the source files for the EZFX2D Sample project http://www.LucidVisionGames.com/Downloads/EZFX2DSample.zip from LucidVisionGames.com