//constructor
        /// <summary>
        /// PlayerEntity, constructor.
        /// </summary>
        public PlayerEntity(PlayerType playerType)
            : base(270.0, 430.0, new HitBox[] { new HitBox(270.0 - (GameResources.GameImage("Player").Width / 2.0), 430.0 - (GameResources.GameImage("Player").Height / 2.0), GameResources.GameImage("Player").Width / 2.0, GameResources.GameImage("Player").Height / 2.0)}, 1, "Player")
        {
            HitBox[] grazeBoxes = new HitBox[] { new HitBox(270.0 - (GameResources.GameImage("Player").Width / 2.0), 430.0 - (GameResources.GameImage("Player").Height / 2.0), GameResources.GameImage("Player").Width, GameResources.GameImage("Player").Height)};

            foreach(HitBox grazeBox in grazeBoxes)
            {
                _grazeBoxes.Add(grazeBox);
            }

            _mainLevel = 0;
            _auxLevel = 0;
        }
Esempio n. 2
0
        //constructor
        /// <summary>
        /// Entity, constructor
        /// </summary>
        /// <param name="x">X position of the entity</param>
        /// <param name="y">Y position of the entity</param>
        /// <param name="hitBoxes">HitBoxes of the entity</param>
        /// <param name="hitPoints">HitPoints of the entity</param>
        /// <param name="bitmap">Bitmap name</param>
        public Entity(double x, double y, HitBox[] hitBoxes, int hitPoints, string bitmap)
        {
            _x = x;
            _y = y;

            foreach(HitBox hitBox in hitBoxes)
            {
                _hitBoxes.Add(hitBox);
            }

            _hitPoints = hitPoints;

            _bitmap = bitmap;

            _tick = 0;
        }
Esempio n. 3
0
 //methods
 /// <summary>
 /// Collides Method
 /// Dectects a colition against the provided Hit Box
 /// </summary>
 /// <param name="hitBox">The Hit Box to check against</param>
 /// <returns>true if colition is detected</returns>
 public bool Collides(HitBox hitBox)
 {
     // HitBoxes Colide if all the folowing conditions are met:
     // x + width > hitBox x
     // x < hitBox x + hitBox width
     // y + height > hitBox y
     // y < hitBox y + hitBox height
     if (_x + _width > hitBox.X && _x < hitBox.X + hitBox.Width && _y + _height > hitBox.Y && _y < hitBox.Y + hitBox.Height)
     {
         return(true);
     }
     else
     {
         return(false);
     }
 }
Esempio n. 4
0
 /// <summary>
 /// RemoveHitBox, removes the provided hitbox
 /// </summary>
 /// <param name="hitBox">HitBox to remove</param>
 public void RemoveHitbox(HitBox hitBox)
 {
     _hitBoxes.Remove(hitBox);
 }
Esempio n. 5
0
 /// <summary>
 /// AddHitBox, adds the provided hitbox to the entities list of hitboxes
 /// </summary>
 /// <param name="hitBox">HitBox to add</param>
 public void AddHitBox(HitBox hitBox)
 {
     _hitBoxes.Add(hitBox);
 }
Esempio n. 6
0
 /// <summary>
 /// RemoveHitBox, removes the provided hitbox
 /// </summary>
 /// <param name="hitBox">HitBox to remove</param>
 public void RemoveHitbox(HitBox hitBox)
 {
     _hitBoxes.Remove(hitBox);
 }
Esempio n. 7
0
 /// <summary>
 /// AddHitBox, adds the provided hitbox to the entities list of hitboxes
 /// </summary>
 /// <param name="hitBox">HitBox to add</param>
 public void AddHitBox(HitBox hitBox)
 {
     _hitBoxes.Add(hitBox);
 }
Esempio n. 8
0
 //methods
 /// <summary>
 /// Collides Method
 /// Dectects a colition against the provided Hit Box
 /// </summary>
 /// <param name="hitBox">The Hit Box to check against</param>
 /// <returns>true if colition is detected</returns>
 public bool Collides(HitBox hitBox)
 {
     // HitBoxes Colide if all the folowing conditions are met:
     // x + width > hitBox x
     // x < hitBox x + hitBox width
     // y + height > hitBox y
     // y < hitBox y + hitBox height
     if(_x + _width > hitBox.X && _x < hitBox.X + hitBox.Width && _y + _height > hitBox.Y && _y < hitBox.Y + hitBox.Height)
     {
         return true;
     }
     else
     {
         return false;
     }
 }
Esempio n. 9
0
        public void TestHitBoxCreation()
        {
            HitBox testHitBox = new HitBox(0, 0, 10, 10);

            Assert.IsInstanceOf <HitBox>(testHitBox);
        }