Exemplo n.º 1
0
        public DeadObject(Element element, Vector2 position)
        {
            switch (element)
              {
            case Element.Domey:
              Type = Element.DeadDomey;
              break;
            case Element.Flappy:
              Type = Element.DeadFlappy;
              break;
            case Element.Spikey:
              Type = Element.DeadSpikey;
              break;
            case Element.Spitter:
              Type = Element.DeadSpitter;
              break;
            case Element.Goat:
              Type = Element.DeadGoat;
              break;
            case Element.Spider:
              Type = Element.DeadSpider;
              break;
            case Element.Cat:
              Type = Element.DeadCat;
              break;
              }

              Position = position;
              Rectangle src = Sprites.GetSlice(Type);
              Texture2D texture = Sprites.GetTexture(Type);

              AnimationObj = new Animation(
            TimeSpan.FromMilliseconds(200f),
            src.Width, src.Height, 1, false);

              Particles = new List<Particle>();

              Vector2 positionCenter = new Vector2(position.X + src.Width / 2, position.Y + src.Height / 2);

              for (int i = 0; i < 50; i++)
            Particles.Add(new Particle(positionCenter));
        }
Exemplo n.º 2
0
        public Player(float x, float y)
        {
            Rectangle src = Sprites.GetSlice(Element.Player);

              Position = new Vector2(x, y);
              Velocity = Vector2.Zero;
              Dst = new Rectangle((int)x, (int)y, src.Width, src.Height);
              ElementType = Element.Player;
              Visible = true;

              XState = HorizontalState.Stopped;
              YState = VerticalState.Falling;
              HState = HealthState.Normal;

              PlayerAnimation = new Animation(
            TimeSpan.FromMilliseconds(200f),
            src.Width,
            src.Height,
            Sprites.GetTexture(Element.Player).Width / src.Width,
            true);

              Direction = 1;
        }