Thought I would post back and say thanks for helping me program the target. It was very straightforward in the end. And if someone else 'Googles' it in the future this is bound to come up!
Identify the centre point, then use the X and Y coordinates of it as a correction factor Use Pythagoras theorem to calculate the hypotenuse of the triangle i.e. the longest side of an imaginary triangle that exists based on the coordinates recorded when somebody touches the screen. Award different points or do different things based on this length. Cheers guys On Aug 3, 9:47 pm, kingh32 <[email protected]> wrote: > Thanks, both of you for your help. > I imagine I'll be back with more questions soon! > > On Aug 3, 8:08 pm, Bob Kerns <[email protected]> wrote: > > > > > Everything -- both the positions and the image widget size -- will be > > in pixel coordinates. Actually, you don't need to know that -- just > > that they're the same. Hell, I could even be wrong; I'm not going to > > take out a microscope and check. > > > If you have different coordinates for your image data (or even if you > > don't or don't know or might want to scale in the future or are > > paranoid), simply scale by the ratio of the image data : image widget. > > A scale factor of 1:1 won't cause you any trouble. > > > There are times to be absolute, and times to be relative. This is one > > of the latter. > > > On Aug 3, 9:25 am, kingh32 <[email protected]> wrote: > > > > Hello - Thanks for your reply! > > > > What you have just mentioned is pretty much where I'm stuck! > > > I don't know how to identify programatically where the target actually > > > is. Would this be done using pixel coordinates? > > > Is there a way to determine the resolution of the phone (screen) that > > > the app is being run on and adjust these calculations accordingly? > > > > Thanks > > > > On Aug 3, 4:52 pm, TreKing <[email protected]> wrote: > > > > > On Tue, Aug 3, 2010 at 4:05 AM, Horace Bell-Gam > > > > <[email protected]>wrote: > > > > > > No, so far all I've been able to do is overlay an image of the target > > > > > and > > > > > make the entire object respond to a click. > > > > > You know: > > > > - The center of the image > > > > - The length of each band > > > > - Where the user clicks on the image (via onTouchEvents, me thinks) > > > > - Simple algebra to calculate the distance of a point from the center > > > > of the > > > > image (I hope) > > > > > That's all you should need to figure out which band the user has > > > > touched. > > > > > What have you tried thus far? Where are you stuck? > > > > > --------------------------------------------------------------------------- > > > > ---------------------- > > > > TreKing <http://sites.google.com/site/rezmobileapps/treking> - Chicago > > > > transit tracking app for Android-powered devices -- You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/android-developers?hl=en

