Exemplo n.º 1
0
        public override void CollideWithUnit(Player Unit)
        {
            Point unitCollisionPoint = new Point(Unit.HitBox().Left + Unit.HitBox().Width/2, Unit.HitBox().Top + Unit.HitBox().Height/2);

            if(HitBox().Contains(unitCollisionPoint) && KeyMouseReader.KeyClick(Keys.Space))
                Unit.ResetPosition();
        }
Exemplo n.º 2
0
        public void Update(Player player, float elapsedTime)
        {
            timeLived += elapsedTime;

            position.X += direction.X * speed;
            position.Y += direction.Y * speed;

            if (timeLived >= lifeTime)
                active = false;

            if (HitBox().Intersects(player.HitBox()))
                if (AccuratePlayerHitCheck(player.HitBox()))
                    active = false;
        }
Exemplo n.º 3
0
        public static void Update(Player player, float elapsedTime)
        {
            for (int i = 0; i < enemyList.Count; i++)
            {
                enemyList[i].Update(elapsedTime, player);

                if (enemyList[i].HitBox().Intersects(player.HitBox()))
                    enemyList[i].CollideWithPlayer(player);

                enemyList[i].SpecialAbility(player);
            }
        }
Exemplo n.º 4
0
        public override void CollideWithUnit(Player Unit)
        {
            Point unitCollisionPointLeft = new Point(Unit.HitBox().Left + 15, Unit.HitBox().Top + Unit.HitBox().Height - 2);
            Point unitCollisionPointRight = new Point(Unit.HitBox().Right - 15, Unit.HitBox().Top + Unit.HitBox().Height - 2);

            if(HitBox().Contains(unitCollisionPointLeft) && HitBox().Contains(unitCollisionPointRight))
                Unit.Jump(1.5f);

            base.CollideWithUnit(Unit);
        }
Exemplo n.º 5
0
 public virtual void CollideWithPlayer(Player player)
 {
     if (PixelCol(HitBox(), colorArray, player.HitBox(), player.ColorArray))
         player.gotKilled = true;
 }