//[CollidingBottom (Void)] //This function checks if the object is colliding with the bottom side of the desired object. protected virtual bool CollidingBottom(Object2D obj) { return(Hitbox.Top + Velocity.Y < obj.Hitbox.Bottom && Hitbox.Bottom > obj.Hitbox.Bottom && Hitbox.Right > obj.Hitbox.Left && Hitbox.Left < obj.Hitbox.Right); }
//[CollidingTop (Void)] //This function checks if the object is colliding with the top side of the desired object. protected virtual bool CollidingTop(Object2D obj) { return(Hitbox.Bottom + Velocity.Y > obj.Hitbox.Top && Hitbox.Top < obj.Hitbox.Top && Hitbox.Right > obj.Hitbox.Left && Hitbox.Left < obj.Hitbox.Right); }
//[CollidingRight (Void)] //This function checks if the object is colliding with the right side of the desired object. protected virtual bool CollidingRight(Object2D obj) { return(Hitbox.Left + Velocity.X < obj.Hitbox.Right && Hitbox.Right > obj.Hitbox.Right && Hitbox.Bottom > obj.Hitbox.Top && Hitbox.Top < obj.Hitbox.Bottom); }
//[Collision Functions (Void)] //All of these functions are used for collision handling. //They all require a Object2D object to be used. //They can all be overrided. //[Colliding (Void)] //This function checks if the object is colliding with the desired object. //This function activates from any side. protected virtual bool Colliding(Object2D obj) { return(Hitbox.Intersects(obj.Hitbox)); }
public static float ObjectHeight(Object2D obj) { Vector2 objSize = obj.sprite.GetSpriteSize(); return(objSize.Y * obj.sprite.Scale.Y); }
public static float ObjectWidth(Object2D obj) { Vector2 objSize = obj.sprite.GetSpriteSize(); return(objSize.X * obj.sprite.Scale.X); }