Hi, I am practicing C# by replicating a simple exercise in Monogame: the code draws a ball, and when I click on the mouse, if the cursor is inside the ball the score value increases; otherwise it does not. To achieve this, the ball position was put in relation with a targetRadius, which is "43", and if I change the value it does not work anymore. I am trying to understand what is happening here, why the radius should be "43" to have the things achieved?
The position of the ball and the radius are defined as follows:
Vector2 targetPosition; const int targetRadius = 43;
Vector2 targetPosition; const int targetRadius = 43;
Then the ball (target) is drawn by subtracting the radius from the coordinates of its position, why is it doing this?
_spriteBatch.Draw(target, new Vector2(targetPosition.X - targetRadius, targetPosition.Y - targetRadius), Color.Aquamarine);
_spriteBatch.Draw(target, new Vector2(targetPosition.X - targetRadius, targetPosition.Y - targetRadius), Color.Aquamarine);