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

From the Asset Store
Fully commented source code/event sheet & sprites to create a space shooter game          • 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: )

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!

• 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

• ## Try Construct 3

Develop games in your browser. Powerful, performant & highly capable.

Construct 3 users don't see these ads
• Thanks for the tips, I'll try it out!

• Now 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 - distancecalculation.info

and you can always find out the exact distance between any two cities in the world.

Also, calculate the 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.

• 4 posts