So my game is about hunting dinosaurs. i have a gun that shoots a sphere at a target. i currently set up a method stating if the sphere is within 2 meters of trex it will turn red. The problem is even if you dont shoot the sphere and you are within 2 meters of the trex it turns red. How can you turn the trex red by only shooting it with the sphere.
One option might be to create a Boolean variable that is only true if the sphere has been fired. You would then need to add a check to the collision routine so it only works if the sphere has been fired. Naturally, you have to reset everything when reloading.