robs0271
robs0271
CC#
Created by robs0271 on 2/3/2024 in #help
Why targetRadius should be "43"?
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; 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); It works, but I don't understand why..
13 replies
CC#
Created by robs0271 on 1/30/2024 in #help
Undestand the "0" value on creation of an entity instance
No description
6 replies
CC#
Created by robs0271 on 1/27/2024 in #help
Explanation of the Value parameter in Class constructor
No description
16 replies