public Entity(Texture2D eTexture, Vector2 pos) { Texture = eTexture; position = pos; srcRect = eTexture.Bounds; collider = new CollisionRect(srcRect,pos); }
public bool test(CollisionRect other) { if (other.rect.Right < rect.Left) { return false; } if (other.rect.Left > rect.Right) { return false; } if (other.rect.Bottom < rect.Top) { return false; } if (other.rect.Top > rect.Bottom) { return false; } return true; }
Vector2 tPos; // tentative position #endregion Fields #region Constructors public Player(Texture2D tex, Vector2 pos) { texture = tex; position = pos; srcRec = new Rectangle(0, 0, tex.Width / 3,tex.Height / 4); collider = new CollisionRect(srcRec); collider.rect.Width = srcRec.Width - 10; collider.rect.Height = srcRec.Height - 17; }