示例#1
0
 public bool IsTouching(SpriteClass otherSprite, double velocity)
 {
     return(IsTouchingLeft(otherSprite, velocity) ||
            IsTouchingRight(otherSprite, velocity) ||
            IsTouchingTop(otherSprite, velocity) ||
            IsTouchingBottom(otherSprite, velocity));
 }
示例#2
0
        public bool IsTouchingRight(SpriteClass otherSprite, double velocity)
        {
            if (!otherSprite.collisionEnabled)
            {
                return(false);
            }

            velocity = Math.Abs(velocity);

            return
                (this.CollisionBox.Right + velocity > otherSprite.CollisionBox.Left &&
                 this.CollisionBox.Left < otherSprite.CollisionBox.Left &&
                 this.CollisionBox.Bottom > otherSprite.CollisionBox.Top &&
                 this.CollisionBox.Top < otherSprite.CollisionBox.Bottom);
        }