473,406 Members | 2,954 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,406 software developers and data experts.

Distance between 2 points user chosen.

Hi everyone. XP Service pack 2, english, python, I am just wondering how i could go about doing this. I am using pygame to draw 25 objects on the screen and they each are assigned a letter of the alphabet A-Y for the function that loads the image. They also have each have a value A1-Y1 for their starting locations. I already have my collision detection written for when the mouse is clicked on one of these objects so thats not a problem. I then want the user to be able to click on two of these objects and have the program find the distance between the two top left pixels of the two objects. The only way i would know of doing this would be through brute force coding using IF statements for every possible combo and finding the distances by manually puting in the A1-Y1 corresponding value for each object and then using the distance formula ( modified for use by a computer oriented with 0,0 in top left) of square root of- {(X2-X1)^2+(Y1-Y2)^2}. I know their is a better way to do this i just dont know how. IF anyone could help it would be much appreciated. Thanx
Jun 28 '08 #1
0 1401

Sign in to post your reply or Sign up for a free account.

Similar topics

20
by: Xenophobe | last post by:
I have successfully converted the ASP code included in the following article to PHP: http://www.4guysfromrolla.com/webtech/040100-1.shtml As described the high and low latitudes and longitudes...
4
by: DellaCroce | last post by:
Does anyone here have the formula for calculating distance give two pairs of Longitude/Latitude coordinates? Please share this with me if you would. -- Greg
3
by: byteschreck | last post by:
Is it possible to change the distance from the form's border the form designer suggests when you use snaplines? I think it should be smaller.
8
by: giloosh | last post by:
how would i get the distance and angle between 2 points on the screen. For example: what is the distance between (100,50) and (250,70) what i really wanna do is see how far the current mouse...
10
by: Alan Johnson | last post by:
24.1.1.3 says about InputIterators: Algorithms on input iterators should never attempt to pass through the same iterator twice. They should be single pass algorithms. In 24.3.4.4 summarizes the...
9
by: nottheartistinquestion | last post by:
As an intellectual exercise, I've implemented an STL-esque List<and List<>::Iterator. Now, I would like a signed distance between two iterators which corresponds to their relative position in the...
1
by: tiffrobe | last post by:
I'm a little lost on my program. Everything works fine except function 3. It gives out garbage numbers. Its suppose to give the distance between two points and then the area of 2 circles. ...
6
by: Tom P. | last post by:
I am writing a drawing program but I want to keep the scale down (there could end up being several hundred objects on the screen). I want to limit the points collected to a certain distance from...
7
by: sandeepshetty | last post by:
hi All, Im new to .NET ... I need your help.. I just wanted to know if their is any method or event in .NET to find the distance between two points clicked using a mouse button.... I...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.