# How do I create a map and calculate distances between points

Get help using Construct 2

### » Wed Sep 07, 2016 12:41 pm

Message: sasemax can only post plain text URLS until they have 500 rep. 1 URLS modified. Why?
Hi, so here's what I'm trying to do: create a map with cities on it. That bit is fairly easy, but then I'm also interested in setting or calculating the distance between each city, so I can determine how long it would take to travel from one city to the next. I'm not a great programmer, but my initial two ideas are either to create an invisible grid and somehow count the tiles between two cities and then convert that to a distance. Or, calculate the actual 'physical' distance between the cities on the map (I googled and found this thread: viewtopic.php?t=65816&start=0)

Are any of these ways feasable or is there a better, smarter way? It would be even more awesome if I could implement the option of multiple routes between each city, say a fast and a slow one for instance. But that would mean that I can't just calculate the distance in the ways I propose above, because they would calculated be in 'bird's flight' I think.

So basically, an example would be "You are in city A. Do you want to travel to city B? It will take you X days" (or seconds or whatever).

I hope this question makes sense. And thanks in advance!
B
7
S
1
Posts: 12
Reputation: 645

### » Wed Sep 07, 2016 5:00 pm

Either work it out prior, add it to an array. Like a grid of cities (like the pokemkn effective types chart)

Or if you have one giant map with the cities on. You can have text say
"time to city"& (distance (city A.x,cityA.y,cityB.x,cityB.y))/speed
This should give the time estimation... for a straight line...

If you have roads, i would advise getting a path finding bot to run the route, set a timer, and stop it when it reaches the target city. Write this down lol
B
9
S
3
Posts: 113
Reputation: 1,009

### » Mon Sep 12, 2016 8:37 pm

Thanks for the tips, I'll try it out!
B
7
S
1
Posts: 12
Reputation: 645

### » Thu Nov 03, 2016 2:26 pm

Message: david80 can only post plain text URLS until they have 500 rep. 3 URLS modified. Why?
Now http://distancecalculation.info/ calculate the distance between any cities of England and the world will be able to
a special calculator that will help every person calculate
any route through several intermediate cities, you will be able to
specify only those cities through which you want to drive - you can specify up to 10 intermediate cities
Use the website for calculating the distance - http://distancecalculation.info/
and you can always find out the exact distance between any two cities in the world.

Also, calculate the http://distancecalculation.info/ distance calculator will calculate how many liters of fuel you spend on route
and its price, estimated travel time, know the exact distance in both kilometers and miles in a straight line
and by road, if you do not like the route that the system itself has chosen for you, you can select
an alternative route, and calculate the distance calculator can take into account your own speed limit
driving on the road, simply select the speed of your movement on the roads, and the calculator will calculate the route according to your
speed drive mode.

The calculator is able to calculate a route only on free roads, which means
that in this mode, the route will be laid exclusively on free roads
avoiding toll stations - it can save your money, calculator can also avoid ferries
in this case, the route will begin only on roads where there is no ferry

Calculator calculates the distance!
In a straight line - the calculation of distance is a straight line.
On the roads - the calculation of the distance is on the road.
Walking - the calculation of the distance is on public roads and sidewalks.
Cycling - the distance calculation is carried out on public roads and cycle paths.

You will be able to visually see any route that you created on the world map
well below the map, you can get detailed instructions from the road all the signs where needed and where to turn
and so on it is very convenient.
B
2
Posts: 1
Reputation: 152