Ejemplo n.º 1
0
        public Game1()
        {
            graphics = new GraphicsDeviceManager(this);
            content = new ContentManager(Services);

            system = new ParticleSystem(this);
        }
Ejemplo n.º 2
0
        public Game1()
        {
            graphics = new GraphicsDeviceManager(this);
            content = new ContentManager(Services);

            //When creating a ParticleSystem, we pass a Game object. The ParticleSystem is 
            //a DrawableGameComponent, so it will update and render automatically.
            system = new ParticleSystem(this);
        }
Ejemplo n.º 3
0
        public Game1()
        {
            graphics = new GraphicsDeviceManager(this);
            content = new ContentManager(Services);

            system = new ParticleSystem(this);
            emitter = new Emitter(1000);
            emitter.ParticleSpeed = 150f;
            emitter.ApplyModifier(new EmitterMouseController(true));

            //When creating an ImageStrip, you must supply 5 pieces of information. You must
            //give the ImageStrip a name, so that Emitters can identify it. You must specify
            //the number of frames in the ImageStrip, and also the width and height of each
            //frame. Finally you must specify the asset name, as specified in the content
            //pipeline.
            strip = new ImageStrip("custom");
            strip.Asset = "CustomParticleImage";
            strip.FrameHeight = 128;
            strip.FrameWidth = 128;
            strip.Frames = 4;

            //When it is done, you will add the ImageStrip to the ParticleSystem.
            system.ImageStrips.Add("custom", strip);

            //Then you will tell the Emitter to use this ImageStrip.
            emitter.ImageStrip = "custom";
            emitter.Frame = 2;

            //When using the ImageStrip, the Emitter will automatically render the
            //specified frame at the correct size, and the origin will always be at the
            //centre of the frame.

            system.AddEmitter(emitter);

            //If you make an error, either by telling the Emitter to use an ImageStrip that
            //doesn't exist, or telling it to use a frame that doesn't exist - The Emitter
            //will instead render Particles with an exclamation mark (!), to let you know
            //that there has been an error.
        }