public bool IsTouching(SpriteClass otherSprite, double velocity) { return(IsTouchingLeft(otherSprite, velocity) || IsTouchingRight(otherSprite, velocity) || IsTouchingTop(otherSprite, velocity) || IsTouchingBottom(otherSprite, velocity)); }
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); }