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
https://forums.phpfreaks.com/topic/273354-setting-a-time-for-certain-links/
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

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!!

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.