Jump to content

Setting a time()+? for certain links


slyte33

Recommended Posts

So I'm making a game.

The game has a village, you start at the center of the village.

North,east,south and west of the village, for example, is "areas" you can travel to.

These areas are stored in the database, with an INT as (travel_time).

I need the travel time to be accurate based on where you're already at and where you plan to go.

I've created a crappy example below..but it would better give an idea as to what I'm asking for:

 

k2ij9i.png

 

 

 

If you're in the center already, the travel time to "Battle2, Training1, Markets1 and Trading1 would all be the same.

What if you are in "Training2" and want to travel to "Trading2". That would be a longer travel time.

 

I'm not sure how to store these in the database to make a formula or something for travel time.

This might be a little confusing, just ask me more questions if needed.

 

Thank you for any help, it is much appreciated.

Link to comment
Share on other sites

Store the times from the centre. Positive values for North and East, negative for South and West

 

eg

Training2 | +2

Training1 | +1

Centre | 0

Trading1 | -1

Trading2 | -2

 

Training1 - Trading1 = 2

Training2 - Trading2 = 4

 

Very smart..I've been trying to think of all kinds of ways to do this and you solved it that quick!

Thank you!!

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.