Exemplo n.º 1
0
        public void Go()
        {
            Video.WindowIcon();
            Video.WindowCaption = "SDL.NET - Sprite Sorting Example";
            screen = Video.SetVideoMode(200, 200, false, false, false);

            s = new Sprite(new Surface(100, 100), new Point(10, 10));
            s2 = new Sprite(new Surface(100, 100), new Point(10, 10));

            s.Surface.Fill(Color.Red);
            s2.Surface.Fill(Color.Blue);

            manager.Add(s);
            manager.Add(s2);

            s2.X = 50;
            s2.Y = 50;

            //Red on top of Blue
            s.Z = 1;
            s2.Z = 0;

            manager.EnableTickEvent();
            SdlDotNet.Core.Events.Tick += new EventHandler<TickEventArgs>(Events_Tick);
            SdlDotNet.Core.Events.Quit += new EventHandler<QuitEventArgs>(Events_Quit);
            Events.Fps = 5;
            SdlDotNet.Core.Events.Run();
        }
Exemplo n.º 2
0
 /// <summary>
 /// 
 /// </summary>
 /// <param name="sprite"></param>
 /// <param name="positionX"></param>
 /// <param name="positionY"></param>
 /// <param name="velocity"></param>
 public ParticleSprite(Sprite sprite, float positionX, float positionY, Vector velocity)
 {
     this.X = positionX;
     this.Y = positionY;
     this.Velocity = velocity;
     m_Sprite = sprite;
 }
Exemplo n.º 3
0
        /// <summary>
        /// 
        /// </summary>
        /// <param name="objectGroup"></param>
        /// <param name="sprite_group"></param>
        /// <param name="offset"></param>
        public static void GroupTransform(Object3d[] objectGroup, Sprite[] spriteGroup, int[] offset)
        {
            /* Calculate the isometric positions of an object group.

                objectGroup: a list of objects for the 3d coordinates to be transformed: list of objects_3d or subclass
                sprite_group: a list of sprites which will be plotted with the isometric coordinates: list of sprites
                offset: 2d vector to add to the isometric coordinates: list of 2 integers [x,y]

                Relies on the same scale system as transform_iso. This is usingant for matching
                sprite dimensions to object coordinates. */
            if (objectGroup == null)
            {
                throw new ArgumentNullException("objectGroup");
            }
            if (spriteGroup == null)
            {
                throw new ArgumentNullException("spriteGroup");
            }
            for (int obj = 0; obj < objectGroup.Length; obj++)
            {
                //finds the isometric coordinate based on the objects position vector and a display offset
                int[] pos = Transform(objectGroup[obj].GetPosition(), offset);
                //Console.WriteLine(pos[0]);
                //Console.WriteLine(pos[1]);
                //Console.WriteLine(objectGroup[obj].size[1]);
                //Console.WriteLine(objectGroup[obj].size[2]);
                //put the new isometric coordinates of the current object into the sprite array
                spriteGroup[obj].X += pos[0] - objectGroup[obj].GetSize()[1];
                spriteGroup[obj].Y += pos[1] - objectGroup[obj].GetSize()[2];
                //sprite_group[obj].Rectangle.Offset(pos[0]-objectGroup[obj].size[1],pos[1]-objectGroup[obj].size[2]);
                //Console.WriteLine(sprite_group[obj].Rectangle.Top);
                //Console.WriteLine(sprite_group[obj].Rectangle.Left);
                //sprite_group[obj].Rectangle.Top=pos[1]-objectGroup[obj].size[2];
            }
        }
Exemplo n.º 4
0
        public PongExample()
        {
            string filePath = Path.Combine("..", "..");
            string fileDirectory = "Data";
            string ballFileName = "ball.png";
            //string paddle1FileName = "paddle1.png";
            //string paddle2FileName = "paddle2.png";

            if (File.Exists(ballFileName))
            {
                filePath = "";
                fileDirectory = "";
            }
            else if (File.Exists(Path.Combine(fileDirectory, ballFileName)))
            {
                filePath = "";
            }

            //string file = Path.Combine(Path.Combine(filePath, fileDirectory), fileName);

            ball = new Sprite(new Surface(Path.Combine(Path.Combine(filePath, fileDirectory), ballFileName)));
            Video.WindowIcon();
            Video.WindowCaption = "SDL.NET - Pong Example";
            Video.SetVideoMode(300, 200);

            ball.Surface.TransparentColor = System.Drawing.Color.Magenta;
        }
Exemplo n.º 5
0
 public virtual void LoadImage(string filePath)
 {
     _graphic = new Sprite(filePath);
     _width = _graphic.Width;
     _height = _graphic.Height;
     _graphic.Transparent = true;
     _graphic.TransparentColor = Color.Lime;
 }
Exemplo n.º 6
0
 public CTileSet(string filename, int tilesize, Color transparent)
 {
     m_tilemap = new Sprite(filename);
     m_tilemap.Transparent = true;
     m_tilemap.TransparentColor = transparent;
     m_tilesize = tilesize;
     m_numx = m_tilemap.Width / m_tilesize;
     m_numy = m_tilemap.Height / m_tilesize;
 }
Exemplo n.º 7
0
 /// <summary>
 /// Constructor
 /// </summary>
 public KillSpriteEventArgs(Sprite sprite)
 {
     if (sprite == null)
     {
         throw new ArgumentNullException("sprite");
     }
     this.sprite = sprite;
     this.rectangle = sprite.LastBlitRectangle;
 }
Exemplo n.º 8
0
        /// <summary>
        /// 
        /// </summary>
        /// <param name="sprite_group"></param>
        /// <param name="iso_draw_order"></param>
        /// <param name="surface"></param>
        /// <returns></returns>
        public static Rectangle[] OrderedDraw(Sprite[] spriteGroup, int[] isoDrawOrder, Surface surface)
        {
            /*/ Draws the sprites to the surface and returns a rect list for surface update

                sprite_group: a list of sprites which will be plotted on the surface: list of sprites
                order: an array of the object numbers in depth order: list of integers
                surface: The pygame display area to be drawn into: surface
                Returns rect: a list of drawn rectangles for updating : list of rect
            /*/
            Rectangle[] rect = new Rectangle[spriteGroup.Length];
            for (int sp = 0; sp < spriteGroup.Length; sp++)
            {
                //Console.WriteLine(sprite_group[iso_draw_order[sp]].Rectangle.Top);
                //Console.WriteLine(sprite_group[iso_draw_order[sp]].Rectangle.Left);
                rect[sp] = surface.Blit(spriteGroup[isoDrawOrder[sp]], spriteGroup[isoDrawOrder[sp]].Rectangle);
            }
            return (rect);
        }
Exemplo n.º 9
0
        /// <summary>
        /// 
        /// </summary>
        /// <param name="skin_group"></param>
        /// <param name="object_group"></param>
        /// <returns></returns>
        public static Sprite[] UpdateImages(Skin[] skinGroup, Object3d[] objectGroup)
        {
            /* updates all the images for every object

                object_group: the objects whose state will be analysed to find the right image: list of objects_3d or subclass
                skin_group: a list of skins which will be used to find the correct image for the objects sprite: list of skins
                Returns sprite_group : sprite_group: a list of sprites which hold the new images: list of sprites 
            */
            Sprite[] sprite_group = new Sprite[objectGroup.Length];
            int i = 0;
            foreach (Object3d obj in objectGroup)
            {
                Sprite sprite = new Sprite();
                sprite.Surface = skinGroup[obj.ObjectType].GetImage(obj);
                sprite.Rectangle = sprite.Surface.Rectangle;
                sprite.Surface.TransparentColor = System.Drawing.Color.White;
                sprite.Surface.Transparent = true;
                sprite_group[i] = sprite;
                i++;
            }
            return (sprite_group);
        }
Exemplo n.º 10
0
 public Rectangle Blit(Sprite sprite, Rectangle destinationRectangle)
 {
     if (sprite == null)
     {
         throw new ArgumentNullException("sprite");
     }
     if (sprite.Visible)
     {
         //return this.Blit(sprite.Render(), destinationRectangle);
         return this.Blit(sprite.Surface, destinationRectangle);
     }
     else
     {
         return new Rectangle();
     }
 }
Exemplo n.º 11
0
 public void SpriteRectangle2()
 {
     VideoSetup();
     Sprite sprite = new Sprite(new Surface(75, 50));
     sprite.BoundingBox = true;
     sprite.Rectangle = new Rectangle(0, 0, 20, 30);
     Assert.AreEqual(20, sprite.Rectangle.Width);
     Assert.AreEqual(30, sprite.Rectangle.Height);
     Events.Close();
 }
Exemplo n.º 12
0
 public void SpriteRectangle()
 {
     VideoSetup();
     Sprite sprite = new Sprite(new Surface(75, 50));
     Assert.AreEqual(75, sprite.Rectangle.Width);
     Assert.AreEqual(50, sprite.Rectangle.Height);
     Events.Close();
 }
Exemplo n.º 13
0
 /// <summary>
 /// 
 /// </summary>
 /// <param name="sprite"></param>
 /// <param name="life"></param>
 public ParticleSprite(Sprite sprite, int life)
 {
     m_Sprite = sprite;
     this.Life = life;
     this.LifeFull = life;
 }
Exemplo n.º 14
0
 /// <summary>
 /// 
 /// </summary>
 /// <param name="disposing"></param>
 protected virtual void Dispose(bool disposing)
 {
     if (!this.disposed)
     {
         if (disposing)
         {
             if (this.ball != null)
             {
                 this.ball.Dispose();
                 this.ball = null;
             }
         }
         this.disposed = true;
     }
 }
Exemplo n.º 15
0
        /// <summary>
        /// Constructs the internal sprites needed for our demo.
        /// </summary>
        public ViewportMode()
        {
            // Create the fragment marbles
            SurfaceCollection td = LoadMarble("marble1");
            SurfaceCollection td2 = LoadMarble("marble2");

            // Load the floor
            SurfaceCollection floorTiles = LoadFloor();

            // Place the floors
            int rows = 8;
            int cols = 15;
            size = new Size(floorTiles[0].Size.Width * cols,
                floorTiles[0].Size.Height * rows);
            rect = new Rectangle(new Point(0, 0), size);

            for (int i = 0; i < cols; i++)
            {
                for (int j = 0; j < rows; j++)
                {
                    // Create the floor tile sprites
                    AnimatedSprite dw =
                        new AnimatedSprite(floorTiles,
                        new Point(i * floorTiles[0].Size.Width,
                        j * floorTiles[0].Size.Height));
                    Sprites.Add(dw);
                }
            }

            // Load the trigger sprite
            sprite = new BounceSprite(td2, rect, new Vector(Randomizer.Next(rect.Left, rect.Right -
                (int)td2.Size.Width),
                Randomizer.Next(rect.Top, rect.Bottom -
                (int)td2.Size.Height), 1));
            Sprites.Add(sprite);
            CenterSprite.Add(sprite);

            // Load the bouncing sprites
            for (int i = 0; i < 10; i++)
            {
                Thread.Sleep(10);
                BounceSprite bounceSprite =
                    new BounceSprite(td,
                    rect,
                    new Vector(Randomizer.Next(rect.Left, rect.Right -
                    (int)td.Size.Width),
                    Randomizer.Next(rect.Top, rect.Bottom -
                    (int)td.Size.Height), 1));
                Sprites.Add(bounceSprite);
            }
        }
Exemplo n.º 16
0
 /// <summary>
 /// Create a particle sprite at a position.
 /// </summary>
 /// <param name="sprite"></param>
 /// <param name="positionX"></param>
 /// <param name="positionY"></param>
 public ParticleSprite(Sprite sprite, float positionX, float positionY)
 {
     this.X = positionX;
     this.Y = positionY;
     m_Sprite = sprite;
 }
Exemplo n.º 17
0
 /// <summary>
 /// Create a particle sprite with a set velocity.
 /// </summary>
 /// <param name="sprite">The sprite to associate with this particle.</param>
 /// <param name="velocity">The velocity of the particle.</param>
 public ParticleSprite(Sprite sprite, Vector velocity)
 {
     this.Velocity = velocity;
     m_Sprite = sprite;
 }
Exemplo n.º 18
0
 /// <summary>
 /// Creates a particle sprite based off an existing sprite.
 /// </summary>
 /// <param name="sprite">The sprite to represent this particle.</param>
 public ParticleSprite(Sprite sprite)
 {
     m_Sprite = sprite;
 }
Exemplo n.º 19
0
 /// <summary>
 /// 
 /// </summary>
 /// <param name="sprite"></param>
 /// <param name="positionX"></param>
 /// <param name="positionY"></param>
 /// <param name="velocity"></param>
 /// <param name="life"></param>
 public ParticleSprite(Sprite sprite, float positionX, float positionY, Vector velocity, int life)
 {
     this.X = positionX;
     this.Y = positionY;
     this.Velocity = velocity;
     m_Sprite = sprite;
     this.Life = life;
     this.LifeFull = life;
 }
Exemplo n.º 20
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);
 }
Exemplo n.º 21
0
 /// <summary>
 /// Creates a new particle emitter that emits sprite objects.
 /// </summary>
 /// <param name="sprite">The sprite to emit.</param>
 public ParticleSpriteEmitter(Sprite sprite)
 {
     m_Sprites = new SpriteCollection();
     m_Sprites.Add(sprite);
 }
Exemplo n.º 22
0
 /// <summary>
 /// Check if two Sprites intersect
 /// </summary>
 /// <param name="sprite">Sprite to check intersection with</param>
 /// <param name="tolerance">The amount of tolerance to give the collision.</param>
 /// <returns>True if sprites intersect</returns>
 public virtual bool IntersectsWith(Sprite sprite, int tolerance)
 {
     if (sprite == null)
     {
         throw new ArgumentNullException("sprite");
     }
     if (sprite.Right - this.Left < tolerance) return false;
     if (sprite.X - this.Right > -tolerance) return false;
     if (sprite.Bottom - this.Y < tolerance) return false;
     if (sprite.Y - this.Bottom > -tolerance) return false;
     return true;
 }
Exemplo n.º 23
0
 /// <summary>
 /// 
 /// </summary>
 /// <param name="sprite"></param>
 /// <param name="velocity"></param>
 /// <param name="life"></param>
 public ParticleSprite(Sprite sprite, Vector velocity, int life)
 {
     this.Velocity = velocity;
     m_Sprite = sprite;
     this.Life = life;
     this.LifeFull = life;
 }
Exemplo n.º 24
0
 /// <summary>
 /// Checks for collision between two sprites using a radius from the center of the sprites.
 /// </summary>
 /// <param name="sprite">The sprite to compare to.</param>
 /// <param name="radius">The radius of the sprites.</param>
 /// <returns>True if they intersect, false if they don't.</returns>
 public virtual bool IntersectsWithRadius(Sprite sprite, int radius)
 {
     return IntersectsWithRadius(sprite, radius, radius, 0);
 }
Exemplo n.º 25
0
 /// <summary>
 /// Check if two Sprites intersect
 /// </summary>
 /// <param name="sprite">Sprite to check intersection with</param>
 /// <returns>True if sprites intersect</returns>
 public virtual bool IntersectsWith(Sprite sprite)
 {
     if (sprite == null)
     {
         throw new ArgumentNullException("sprite");
     }
     return this.IntersectsWith(sprite.Rectangle);
 }
Exemplo n.º 26
0
 public SolidEntity(Sprite sprite)
     : base(sprite, 0, 0, new Vector(), 0)
 {
     this.currentCollisions = new List<SolidEntity>();
 }
Exemplo n.º 27
0
        /// <summary>
        /// Checks for collision between two sprites using a radius from the center of the sprites.
        /// </summary>
        /// <param name="sprite">The sprite to compare to.</param>
        /// <param name="radius">The radius of the current sprite. Defaults to the radius of the sprite.</param>
        /// <param name="radiusOther">The other sprite's radius. Defaults to the radius of the sprite.</param>
        /// <param name="tolerance">The size of the buffer zone for collision detection. Defaults to 0.</param>
        /// <returns>True if they intersect, false if they don't.</returns>
        /// <remarks>If they radius is not given, it calculates it for you using half the width plus half the height.</remarks>
        public virtual bool IntersectsWithRadius(Sprite sprite, int radius, int radiusOther, int tolerance)
        {
            if (sprite == null)
            {
                throw new ArgumentNullException("sprite");
            }
            Point center1 = this.Center;
            Point center2 = sprite.Center;
            int xdiff = center2.X - center1.X;	// x plane difference
            int ydiff = center2.Y - center1.Y;	// y plane difference

            // distance between the circles centres squared
            int dcentre_sq = (ydiff * ydiff) + (xdiff * xdiff);

            // calculate sum of radiuses squared
            int r_sum_sq = radius + radiusOther;
            r_sum_sq *= r_sum_sq;

            return (dcentre_sq - r_sum_sq <= (tolerance * tolerance));
        }
Exemplo n.º 28
0
 public SolidEntity(Sprite sprite, float x, float y, Vector vector, int life)
     : base(sprite, x, y, vector, life)
 {
     this.currentCollisions = new List<SolidEntity>();
 }
Exemplo n.º 29
0
 /// <summary>
 /// Checks for collision between two sprites using a radius from the center of the sprites.
 /// </summary>
 /// <param name="sprite">The sprite to compare to.</param>
 /// <returns>True if they intersect, false if they don't.</returns>
 /// <remarks>The radius for both the sprites is calculated by using half the width and half the height.</remarks>
 public virtual bool IntersectsWithRadius(Sprite sprite)
 {
     if (sprite == null)
     {
         throw new ArgumentNullException("sprite");
     }
     int r1 = (this.Width + this.Height) / 4;
     int r2 = (sprite.Width + sprite.Height) / 4;
     return IntersectsWithRadius(sprite, r1, r2, 0);
 }
Exemplo n.º 30
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);
        }