I'm making a game in Java w/ slick and lwjgl and right now I want to do the following: draw a circle, that is drawn around an object with a radius of e.g. 75. I want the object to be IN THE MIDDLE of that circle. That is easy but I also want the circle to become smaller when the player enters it. Basically this is an example:
Players x is 100
The OBJECT'S x is 300
The circle's x is (300-75 == 225),(object's x - radius) and its width is radius*2, so 150
When the player is inside of the circle (players x > circles x; e.g. 230 > 225) then I want the RADIUS of the circle to shrink to 70 (75 - (230 - 225), or, radius - (palyers x - circles x)), and after the circle shrank it should still be perfectly around the object from before. (AND BTW I didn't mention the y variable because it's self-explanatory after I figure out the x) Can anyone explain me the maths behind it please. Thank you