Yes, what you have there is a "bounding box" check.

The way to do the proper check it is to find the distance between the X / Y coordinates that were clicked on, and the asteroid's X / Y coordinates (see below for how to do this). Then, you compare that distance with the asteroid's radius. If the distances is less than the radius, the player clicked on the asteroid. If it's more than the radius, they didn't click on the asteroid.

If you then check that NONE of the asteroids was clicked on, we can then say confidently that the player clicked in empty space. :>

To find the distance between a point (x,y), and an asteroid's X/Y, you do pythagoras. :> (yep, it crops up again and again!)

The general equation for pythagoras is:

**a^2 = b^2 + c^2**

Where a = the distance we are trying to find, b is the difference between the two X's, and c is the difference between the two Y's.

We want a, not a^2, so we reorganise it to look like this:

**a = math.sqrt(b^2 + c^2)**

Now, to find **b** and **c**.

b = GetAsteroid(i).position.x - ClickedX

c = GetAsteroid(i).position.y - ClickedY

Finally, for efficiency's sake, you might prefer to not use a square root, and just do b^2 + c^2. Then, when you do the comparison, check if b^2 + c^2 is more or less than GetAsteroid(i).radius^2.

That results in a cheaper set of calculations (because you never have to use math.sqrt) so the code will run faster. :>

Hope this helps!