Esempio n. 1
0
 public Espada(Xena owner, int energy = 10)
 {
     xena        = owner;
     Rectangle   = new Rectangle(owner.Rectangle.Center, new Point(50, 25));
     Image       = Game1.TheGame.Content.Load <Texture2D>("Images/bala");
     Color       = Color.White;
     Speed       = 5;
     this.energy = energy;
 }
Esempio n. 2
0
        public override void Update(GameTime gametime)
        {
            int x;

            x  = Rectangle.X;
            x -= 2;

            Rectangle = new Rectangle(x, Rectangle.Y, Rectangle.Width, Rectangle.Height);

            if (Rectangle.X < -100)
            {
                Game1.TheGame.actualizaciones.Add(this);
            }

            if (gametime.TotalGameTime.Subtract(lastTime).Milliseconds > 500)
            {
                Xena xena = null;
                foreach (var item in Game1.TheGame.sprites)
                {
                    if (item is Xena)
                    {
                        xena = item as Xena;
                        break;
                    }
                }

                if (Rectangle.Intersects(xena.Rectangle))
                {
                    xena.Health -= 1;
                }
            }

            if (this.Health <= 0)
            {
                Game1.TheGame.actualizaciones.Add(this);
            }
        }