예제 #1
0
 /// <summary>
 /// Creates a particle emitter that emits particels inside the given system with min and max color values.
 /// </summary>
 /// <param name="system">The system that the particle emitter should be added to.</param>
 /// <param name="minColor">The minimum color values of emitted particles.</param>
 /// <param name="maxColor">The maximum color values of emitted particles.</param>
 /// <param name="radiusMin">The minimum radius of a particle.</param>
 /// <param name="radiusMax">The maximum radius of a particle.</param>
 public ParticleCircleEmitter(ParticleSystem system, Color minColor, Color maxColor, short radiusMin, short radiusMax)
     : base(system)
 {
     ColorMin = minColor;
     ColorMax = maxColor;
     m_RadiusMin = radiusMin;
     m_RadiusMax = radiusMax;
 }
예제 #2
0
 /// <summary>
 /// Copy Constructor.
 /// </summary>
 /// <param name="system">The particle system to copy.</param>
 public ParticleSystem(ParticleSystem system)
 {
     if (system == null)
     {
         throw new ArgumentNullException("system");
     }
     m_Manipulators = new ParticleManipulatorCollection(system.Manipulators);
     m_Particles = new ParticleCollection();
     m_Particles.Add(system);
 }
예제 #3
0
 /// <summary>
 /// Creates a new particle emitter that emits sprite objects.
 /// </summary>
 /// <param name="system">The particle system to add this particle emitter.</param>
 /// <param name="sprites">The sprite collection to choose sprites from when emitting.</param>
 public ParticleSpriteEmitter(ParticleSystem system, SpriteCollection sprites)
     : base(system)
 {
     m_Sprites = sprites;
 }
예제 #4
0
 /// <summary>
 /// Creates a new particle emitter that emits sprite objects.
 /// </summary>
 /// <param name="system">The particle system to add this particle emitter.</param>
 /// <param name="sprite">The sprite to emit.</param>
 public ParticleSpriteEmitter(ParticleSystem system, Sprite sprite)
     : base(system)
 {
     m_Sprites = new SpriteCollection();
     m_Sprites.Add(sprite);
 }
예제 #5
0
 /// <summary>
 /// Creates a new pixel particle emitter inside a particle system.
 /// </summary>
 /// <param name="system">The system to add to.</param>
 protected ParticleEmitter(ParticleSystem system)
     : this()
 {
     if (system == null)
     {
         throw new ArgumentNullException("system");
     }
     system.Add(this, true);
 }
예제 #6
0
        public Vista(int ancho, int alto)
        {
            pared = new Dictionary<string, Sprite>();
            pared.Add("pared01",new Sprite(new Surface(Resource1.pared01)));
            pared.Add("pared2", new Sprite(new Surface(Resource1.pared2)));
            pared.Add("pared3", new Sprite(new Surface(Resource1.pared3)));
            pared.Add("pared4", new Sprite(new Surface(Resource1.pared4)));
            pared.Add("pared5", new Sprite(new Surface(Resource1.pared5)));

            #region spritesBub
            bub = new Dictionary<string, Sprite>();
            Sprite bubc1 = new Sprite(new Surface(Resource1.bubc1));
            Sprite bubc2 = new Sprite(new Surface(Resource1.bubc2));
            Sprite bubc3 = new Sprite(new Surface(Resource1.bubc3));
            Sprite bubc1i = new Sprite(new Surface(Resource1.bubc1i));
            Sprite bubc2i = new Sprite(new Surface(Resource1.bubc2i));
            Sprite bubc3i = new Sprite(new Surface(Resource1.bubc3i));
            Sprite bubm1 = new Sprite(new Surface(Resource1.bubm1));
            Sprite bubm2 = new Sprite(new Surface(Resource1.bubm2));
            Sprite bubm3 = new Sprite(new Surface(Resource1.bubm3));
            Sprite bubm4 = new Sprite(new Surface(Resource1.bubm4));
            Sprite frente = new Sprite(new Surface(Resource1.bubfte));

            bub.Add("derecha1", bubc1);
            bub.Add("derecha2", bubc2);
            bub.Add("derecha3", bubc3);
            bub.Add("izquierda1", bubc1i);
            bub.Add("izquierda2", bubc2i);
            bub.Add("izquierda3", bubc3i);
            bub.Add("muerto1", bubm1);
            bub.Add("muerto2", bubm2);
            bub.Add("muerto3", bubm3);
            bub.Add("muerto4", bubm4);
            bub.Add("frente", frente);

            foreach (KeyValuePair<string, Sprite> par in bub)
            {
                par.Value.Transparent = true;
                par.Value.TransparentColor = Color.Magenta;
            }

            #endregion spritesBub

            #region spritesBob
            bob = new Dictionary<string, Sprite>();

            bubc1 = new Sprite(new Surface(Resource1.bobc1));
            bubc2 = new Sprite(new Surface(Resource1.bobc2));
            bubc3 = new Sprite(new Surface(Resource1.bobc3));
            bubc1i = new Sprite(new Surface(Resource1.bobc1i));
            bubc2i = new Sprite(new Surface(Resource1.bobc2i));
            bubc3i = new Sprite(new Surface(Resource1.bobc3i));
            bubm1 = new Sprite(new Surface(Resource1.bobm1));
            bubm2 = new Sprite(new Surface(Resource1.bobm2));
            bubm3 = new Sprite(new Surface(Resource1.bobm3));
            bubm4 = new Sprite(new Surface(Resource1.bobm4));
            frente = new Sprite(new Surface(Resource1.bobfte));

            bob.Add("derecha1", bubc1);
            bob.Add("derecha2", bubc2);
            bob.Add("derecha3", bubc3);
            bob.Add("izquierda1", bubc1i);
            bob.Add("izquierda2", bubc2i);
            bob.Add("izquierda3", bubc3i);
            bob.Add("muerto1", bubm1);
            bob.Add("muerto2", bubm2);
            bob.Add("muerto3", bubm3);
            bob.Add("muerto4", bubm4);
            bob.Add("frente", frente);

            foreach (KeyValuePair<string, Sprite> par in bob)
            {
                par.Value.Transparent = true;
                par.Value.TransparentColor = Color.Magenta;
            }

            #endregion spritesBob

            #region burbujaVerde
            bvd1 = new Sprite(new Surface(Resource1.bvd1));
            bvd2 = new Sprite(new Surface(Resource1.bvd2));
            bvd3 = new Sprite(new Surface(Resource1.bvd3));
            bvd4 = new Sprite(new Surface(Resource1.bvd4));
            bv = new Sprite(new Surface(Resource1.bv));
            bvr1 = new Sprite(new Surface(Resource1.bvr1));
            bvr2 = new Sprite(new Surface(Resource1.bvr2));

            bvd1.Transparent = true;
            bvd1.TransparentColor = Color.Magenta;
            bvd2.Transparent = true;
            bvd2.TransparentColor = Color.Magenta;
            bvd3.Transparent = true;
            bvd3.TransparentColor = Color.Magenta;
            bvd4.Transparent = true;
            bvd4.TransparentColor = Color.Magenta;
            bv.Transparent = true;
            bv.TransparentColor = Color.Magenta;
            bvr1.Transparent = true;
            bvr1.TransparentColor = Color.Magenta;
            bvr2.Transparent = true;
            bvr2.TransparentColor = Color.Magenta;
            #endregion burbujaVerde

            #region spriteRobotito
            Sprite rob0 = new Sprite(new Surface(Resource1.rt0));
            Sprite rob0i = new Sprite(new Surface(Resource1.rt0i));
            Sprite rob1 = new Sprite(new Surface(Resource1.rt1));
            Sprite rob1i = new Sprite(new Surface(Resource1.rt1i));
            Sprite rob2 = new Sprite(new Surface(Resource1.rt2));
            Sprite rob2i = new Sprite(new Surface(Resource1.rt2i));
            Sprite rob3 = new Sprite(new Surface(Resource1.rt3));
            Sprite rob3i = new Sprite(new Surface(Resource1.rt3i));
            Sprite renc = new Sprite(new Surface(Resource1.renc));
            Sprite renc1 = new Sprite(new Surface(Resource1.renc1));
            Sprite renc2 = new Sprite(new Surface(Resource1.renc2));
            Sprite rfrente = new Sprite(new Surface(Resource1.rtf));

            robotito = new Dictionary<string, Sprite>();
            robotito.Add("derecha0", rob0);
            robotito.Add("derecha1", rob1);
            robotito.Add("derecha2", rob2);
            robotito.Add("derecha3", rob3);
            robotito.Add("izquierda0", rob0i);
            robotito.Add("izquierda1", rob1i);
            robotito.Add("izquierda2", rob2i);
            robotito.Add("izquierda3", rob3i);
            robotito.Add("encerradomedio", renc);
            robotito.Add("encerrado1", renc1);
            robotito.Add("encerrado2", renc2);
            robotito.Add("frente", rfrente);
            foreach (KeyValuePair<string, Sprite> par in robotito)
            {
                par.Value.Transparent = true;
                par.Value.TransparentColor = Color.Magenta;
            }
            #endregion spriteRobotito

            #region spriteViejita
            Sprite viej0=new Sprite(new Surface(Resource1.vi1));
            Sprite viej1 = new Sprite(new Surface(Resource1.vi2));
            Sprite viej2 = new Sprite(new Surface(Resource1.vi3));
            Sprite viej3 = new Sprite(new Surface(Resource1.vi4));
            Sprite viej0i = new Sprite(new Surface(Resource1.vii1));
            Sprite viej1i = new Sprite(new Surface(Resource1.vii2));
            Sprite viej2i = new Sprite(new Surface(Resource1.vii3));
            Sprite viej3i = new Sprite(new Surface(Resource1.vii4));
            Sprite vieje = new Sprite(new Surface(Resource1.vienc));
            Sprite vieje1 = new Sprite(new Surface(Resource1.vienc1));
            Sprite vieje2 = new Sprite(new Surface(Resource1.vienc2));
            Sprite vif = new Sprite(new Surface(Resource1.vif));

            viejita = new Dictionary<string, Sprite>();
            viejita.Add("derecha0", viej0);
            viejita.Add("derecha1", viej1);
            viejita.Add("derecha2", viej2);
            viejita.Add("derecha3", viej3);
            viejita.Add("izquierda0", viej0i);
            viejita.Add("izquierda1", viej1i);
            viejita.Add("izquierda2", viej2i);
            viejita.Add("izquierda3", viej3i);
            viejita.Add("encerradomedio", vieje);
            viejita.Add("encerrado1", vieje1);
            viejita.Add("encerrado2", vieje2);
            viejita.Add("frente", vif);

            fireball = new Sprite(new Surface(Resource1.fireball));

            foreach(KeyValuePair<string,Sprite> par in viejita)
            {
                par.Value.Transparent = true;
                par.Value.TransparentColor = Color.Magenta;
            }
            #endregion spriteViejita

            particles = new ParticleSystem();

            #region frutas
            sprcereza = new Sprite(new Surface(Resource1.fruta001));
            sprcereza.TransparentColor = Color.Magenta;
            sprcereza.Transparent = true;
            #endregion frutas

            vidaBub = new Sprite(new Surface(Resource1.vidaBub));
            vidaBub.TransparentColor = Color.Magenta;
            vidaBub.Transparent = true;

            vidaBob = new Sprite(new Surface(Resource1.vidaBob));
            vidaBob.TransparentColor = Color.Magenta;
            vidaBob.Transparent = true;

            this.alto = alto;
            this.ancho = ancho;
            this.unidad = 5;
            fullscreen = false;

            screen=Video.SetVideoMode(ancho, alto, false, false, fullscreen);
            Video.WindowCaption = "Re-Bubble Bobble";
            Video.WindowIcon(Resource1.icono);

            fuente = new SdlDotNet.Graphics.Font(Resource1.arial, 20);
        }
예제 #7
0
 /// <summary>
 /// Creates a new rectangle particle within a system with a max and min size.
 /// </summary>
 /// <param name="system">The parent system of the emitter.</param>
 /// <param name="minSize">The minimum size of rectangle particles.</param>
 /// <param name="maxSize">The maximum size of rectangle particles.</param>
 public ParticleRectangleEmitter(ParticleSystem system, SizeF minSize, SizeF maxSize)
     : base(system)
 {
     this.MinSize = minSize;
     this.MaxSize = maxSize;
 }
예제 #8
0
 /// <summary>
 /// Creates a new rectangle particle within a system.
 /// </summary>
 /// <param name="system">The parent system of the emitter.</param>
 public ParticleRectangleEmitter(ParticleSystem system)
     : base(system)
 {
 }
예제 #9
0
 /// <summary>
 /// Creates a new particle emitter that emits surface objects.
 /// </summary>
 /// <param name="system">The particle system to add this particle emitter.</param>
 /// <param name="surfaces">The surface collection to choose surfaces from when emitting.</param>
 public ParticleSurfaceEmitter(ParticleSystem system, SurfaceCollection surfaces)
     : base(system)
 {
     m_Surfaces = surfaces;
 }
예제 #10
0
 /// <summary>
 /// Creates a new particle emitter that emits surface objects.
 /// </summary>
 /// <param name="system">The particle system to add this particle emitter.</param>
 /// <param name="surface">The surface to emit.</param>
 public ParticleSurfaceEmitter(ParticleSystem system, Surface surface)
     : base(system)
 {
     m_Surfaces = new SurfaceCollection();
     m_Surfaces.Add(surface);
 }
예제 #11
0
파일: Player.cs 프로젝트: davinx/PitchPitch
        protected virtual void initExplosion()
        {
            _ptclSystem = new ParticleSystem();
            _ptclEmitter = new ParticleSurfaceEmitter(_explosionColoredSurfaces == null ? _explosionSurfaces : _explosionColoredSurfaces);
            _ptclEmitter.Frequency = 300;
            _ptclEmitter.LifeFullMin = 20;
            _ptclEmitter.LifeFullMax = 40;
            _ptclEmitter.LifeMin = 10;
            _ptclEmitter.LifeMax = 30;
            _ptclEmitter.DirectionMin = -(float)Math.PI;
            _ptclEmitter.DirectionMax = (float)Math.PI;
            _ptclEmitter.SpeedMin = 5;
            _ptclEmitter.SpeedMax = 6;

            _ptclSystem.Add(_ptclEmitter);

            _ptclSystem.Manipulators.Add(new ParticleGravity(0.2f)); // Gravity
            _ptclSystem.Manipulators.Add(new ParticleFriction(0.3f)); // Slow down _ptclSystem
            //_ptclSystem.Manipulators.Add(new ParticleVortex(1f, 200f)); // A particle vortex fixed on the mouse
            _ptclSystem.Manipulators.Add(new ParticleBoundary(new Size(Constants.StageViewWidth, Constants.StageViewHeight))); // fix _ptclSystem on screen.
        }
예제 #12
0
 /// <summary>
 /// Creates a particle emitter that emits particels inside the given system with min and max color values.
 /// </summary>
 /// <param name="system">The system that the particle emitter should be added to.</param>
 /// <param name="minColor">The minimum color values of emitted particles.</param>
 /// <param name="maxColor">The maximum color values of emitted particles.</param>
 public ParticlePixelEmitter(ParticleSystem system, Color minColor, Color maxColor)
     : base(system)
 {
     ColorMin = minColor;
     ColorMax = maxColor;
 }
예제 #13
0
 /// <summary>
 /// Creates a new pixel particle emitter inside a particle system.
 /// </summary>
 /// <param name="system">The system that the particle emitter should be added to.</param>
 public ParticlePixelEmitter(ParticleSystem system)
     : base(system)
 {
 }
예제 #14
0
 /// <summary>
 /// Creates a new pixel particle emitter inside a particle system.
 /// </summary>
 /// <param name="system">The system that the particle emitter should be added to.</param>
 public ParticleCircleEmitter(ParticleSystem system)
     : base(system)
 {
 }
예제 #15
0
        public OrbitClash()
        {
            Video.WindowIcon();

            Video.SetVideoMode(Configuration.DisplaySize.Width, Configuration.DisplaySize.Height, false);

            Video.WindowCaption = Configuration.Title;

            Mixer.ChannelsAllocated = Configuration.MaxSoundChannels;

            this.theGameHasBegun = false;

            this.particleSystem = new ParticleSystem();

            this.mainTitle = new MainTitle();

            Surface infoBarSurface = new Surface(Configuration.InfoBar.ImageFilename);
            this.infoBar = infoBarSurface.Convert(Video.Screen, true, false);

            // Player 1.
            this.player1 = new Player(1);
            this.player1.LeftKey = Configuration.Controls.Player1.Left;
            this.player1.RightKey = Configuration.Controls.Player1.Right;
            this.player1.UpKey = Configuration.Controls.Player1.Up;
            this.player1.DownKey = Configuration.Controls.Player1.Down;
            this.player1.FireKey = Configuration.Controls.Player1.Fire;

            // Player 2.
            this.player2 = new Player(2);
            this.player2.LeftKey = Configuration.Controls.Player2.Left;
            this.player2.RightKey = Configuration.Controls.Player2.Right;
            this.player2.UpKey = Configuration.Controls.Player2.Up;
            this.player2.DownKey = Configuration.Controls.Player2.Down;
            this.player2.FireKey = Configuration.Controls.Player2.Fire;

            this.bulletShipImpactSound = new Sound(Configuration.Bullets.BulletShipImpactSoundFilename);
            this.bulletShipImpactSound.Volume = Configuration.SoundVolume;

            this.bulletShipImpactBounceSound = new Sound(Configuration.Bullets.BulletShipImpactBounceSoundFilename);
            this.bulletShipImpactBounceSound.Volume = Configuration.SoundVolume;

            this.bulletPlanetImpactSound = new Sound(Configuration.Bullets.BulletPlanetImpactSoundFilename);
            this.bulletPlanetImpactSound.Volume = Configuration.SoundVolume;

            this.shipShipImpactSound = new Sound(Configuration.Ships.ShipShipImpactSoundFilename);
            this.shipShipImpactSound.Volume = Configuration.SoundVolume;

            // Setup screen bounce-boundary manipulator.
            this.boundaryManipulator = new ParticleBoundary(new Rectangle(Configuration.PlayArea.Location, Configuration.PlayArea.Size));
            this.particleSystem.Manipulators.Add(this.boundaryManipulator);

            // Set up star-background.
            Surface backgroundSurface = new Surface(Configuration.PlayAreaBackgroundImageFilename);
            this.background = backgroundSurface.Convert(Video.Screen, true, false);

            // Setup the planet.
            Point planetLocation = new Point(Configuration.PlayArea.Width / 2, Configuration.PlayArea.Height / 2);
            this.planet = new Planet(Configuration.Planet.ImageFilename, Configuration.Planet.ImageTransparentColor, planetLocation, Configuration.Planet.ImageScale);
            this.particleSystem.Add(this.planet);

            // Draw the planetary halo onto the background.
            if (Configuration.Planet.ShowPlanetaryHalo)
            {
                Point haloPosition = new Point(this.planet.Center.X - Configuration.Planet.GravityWellRadius, this.planet.Center.Y - Configuration.Planet.GravityWellRadius);
                this.background.Blit(this.planet.HaloSurface, haloPosition);
            }

            // Setup the gravity manipulator.
            this.gravityManipulator = new GravityWell(this.planet.Center, Configuration.Planet.GravityWellRadius, Configuration.Planet.GravityPower);
            this.particleSystem.Manipulators.Add(this.gravityManipulator);

            // Setup speed limit manipulator.
            this.speedLimitManipulator = new SpeedLimit(Configuration.UniversalSpeedLimit);
            //this.particleSystem.Manipulators.Add(this.speedLimitManipulator);

            Events.KeyboardDown += new EventHandler<KeyboardEventArgs>(this.KeyboardDown);
            Events.KeyboardUp += new EventHandler<KeyboardEventArgs>(this.KeyboardUp);

            Events.Fps = Configuration.Fps;

            Events.Tick += new EventHandler<TickEventArgs>(this.Tick);
            Events.Quit += new EventHandler<QuitEventArgs>(this.Quit);
        }