On Sep 12, 2012, at 1:09 AM, iQue <max.nielse...@gmail.com> wrote: > > Say the joysticks background image is 50x50, how do I make a circle in > android with this size in mind, and how do i check if im pressing within it.
Use distance, int dx = imgCenterX - touch.x; int dy = imgCenterY - touch.y; float distance = FloatMath.sqrt(dx * dx + dy * dy); // Out of bounds check. if (distance > 25) { touch.x *= 1f / distance; touch.y *= 1f / distance; } Or something like this might work. -- H -- You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en