Planets map
Planets map
Planets map
Planets map
Planets map
Planets map Planets map Planets map Planets map Planets map Planets map Planets map Planets map
Planets map Planets map
Planets map
Go Back  Xtreme Visual Basic Talk > > > Planets map


Reply
 
Thread Tools Display Modes
  #1  
Old 03-11-2013, 05:11 PM
Ambrose60506 Ambrose60506 is offline
Newcomer
 
Join Date: Mar 2013
Posts: 3
Default Planets map


Okay i am trying to set up a form that has a series on 9 image boxes on it in various location. One the form loads the player is located on planet 1. but i need to be able to click on each planet and have it tell my how far it is to that planet from the current location and then set the location of the new planet as the new player location. Is there a way to find the absolute location of the imagebox so i can calulate the ingame distance so i can set up fuel usage.



B
Reply With Quote
  #2  
Old 03-11-2013, 05:35 PM
Gruff's Avatar
GruffPlanets map Gruff is offline
Bald Mountain Survivor

Retired Moderator
* Expert *
 
Join Date: Aug 2003
Location: Oregon, USA - deceased
Posts: 6,440
Default

If you want to calculate from center to center of the imageboxes.

CenterX = Planets(index).left + (Planets(index).Width \ 2)
CenterY = Planets(index).top + (Planets(index).Height \ 2)

Get the center X,Y of any two image boxes and calulate the hypotnuse
of the delta x and y between them.
__________________
Burn the land and boil the sea
You can't take the sky from me


~T
Reply With Quote
  #3  
Old 03-12-2013, 04:58 PM
Ambrose60506 Ambrose60506 is offline
Newcomer
 
Join Date: Mar 2013
Posts: 3
Default

Thank you for your reply

Okay i am following the first part of getting the xy but waht is the the last part with the delta and hypotnuse

B.
Reply With Quote
  #4  
Old 03-12-2013, 07:32 PM
surfR2911 surfR2911 is offline
Contributor
 
Join Date: Oct 2009
Posts: 719
Default Delta and hypotenuse

Do you know what delta is (or represents)?

Per this Wikipedia article:
Quote:
Change of any changeable quantity, in mathematics and the sciences (More specifically, the difference operator..)
So delta of x equals x2 - x1, and delta of y equals y2 - y1


If you don't understand hypotenuse here's a tutorial:
vb tutorial - simple function to compute hypotenuse of a right triangle
(where the hypotenuse is the longest side of a triangle facing the perpendicular angle)

"Sqr" is the in-built square root function under VB6.

The square root calculation of the hypotenuse is based on the Pythagorean theorem:
a squared + b squared = c squared

by the way - this has been covered many many times before on the forum.
I remember this old post even included a diagram as an attachment,
but I think BillSoo explained it better in this really old post (which includes code for a GetDistance function).

Last edited by surfR2911; 03-12-2013 at 07:59 PM.
Reply With Quote
  #5  
Old 03-12-2013, 09:11 PM
Ambrose60506 Ambrose60506 is offline
Newcomer
 
Join Date: Mar 2013
Posts: 3
Default

thanks for the info i will read the old posts as well

B
Reply With Quote
  #6  
Old 03-12-2013, 10:23 PM
Gruff's Avatar
GruffPlanets map Gruff is offline
Bald Mountain Survivor

Retired Moderator
* Expert *
 
Join Date: Aug 2003
Location: Oregon, USA - deceased
Posts: 6,440
Default

Perhaps this attached picture will help.
Attached Images
File Type: png Planets.PNG (14.2 KB, 20 views)
__________________
Burn the land and boil the sea
You can't take the sky from me


~T
Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Forum Jump

Advertisement:





Free Publications
The ASP.NET 2.0 Anthology
101 Essential Tips, Tricks & Hacks - Free 156 Page Preview. Learn the most practical features and best approaches for ASP.NET.
subscribe
Programmers Heaven C# School Book -Free 338 Page eBook
The Programmers Heaven C# School book covers the .NET framework and the C# language.
subscribe
Build Your Own ASP.NET 3.5 Web Site Using C# & VB, 3rd Edition - Free 219 Page Preview!
This comprehensive step-by-step guide will help get your database-driven ASP.NET web site up and running in no time..
subscribe
Planets map
Planets map
Planets map Planets map
Planets map
Planets map
Planets map Planets map Planets map Planets map Planets map Planets map Planets map
Planets map
Planets map
 
Planets map
Planets map
 
-->