Exemple #1
0
        protected virtual bool Collides(Basic2d asset)
        {
            Rectangle box = BoundingBox;

            box.Y -= box.Height;
            return(box.Intersects(asset.BoundingBox));
        }
Exemple #2
0
        protected override bool Collides(Basic2d asset)
        {
            Rectangle box = BoundingBox;

            box.Y -= box.Height;
            if (box.Intersects(asset.BoundingBox))
            {
                Direction  = !Direction;
                PixesMoved = 0;
                return(true);
            }
            else
            {
                return(false);
            }
        }
Exemple #3
0
        private bool CollidesCharacter(Basic2d asset)
        {
            Rectangle box;

            foreach (Enemy enemy in Globals.EnemiesAssets)
            {
                box    = enemy.BoundingBox;
                box.Y -= box.Height;
                if (asset.BoundingBox.Intersects(box))
                {
                    return(true);
                }
            }

            box    = Globals.Hero.BoundingBox;
            box.Y -= box.Height;
            if (asset.BoundingBox.Intersects(box))
            {
                return(true);
            }

            return(false);
        }