well simply i am coding an animation using netbeans but i wish to calculate the distance between my animation and the landing strip. i am using two labels in the animation, one is a rocket which you can direct and the other is a landing strip. How am i able to calculate the distance between the two? Thank :)

Recommended Answers

All 2 Replies

Use the location method of the label to get the, well, location. Then use the standard distance formula to calculate the distance (Square root of ((x1-x2)^2 + (y1-y2)^2)).

Get their positions and use Pythagorus' theorem.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.