Say there 100 copies of an apple and 1 orange on screen and the apples and the orange are continuously moving in random directions. Say i only want to pick the apple that is 5 pixels to the right of the orange at any given instant. How do i go about doing this?.
And also i want to set a global variable to 1 whenever an apple is 5 pixels to the right of orange and then back to zero when no apple is 5 pixels to the right of orange.
I seem to either not be able to pick an apple or when i do pick an apple and set variable to 1,i'm unable to reset the variable back to zero.