slyte33 Posted January 19, 2013 Share Posted January 19, 2013 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: 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. Quote Link to comment https://forums.phpfreaks.com/topic/273354-setting-a-time-for-certain-links/ Share on other sites More sharing options...
Barand Posted January 19, 2013 Share Posted January 19, 2013 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 Quote Link to comment https://forums.phpfreaks.com/topic/273354-setting-a-time-for-certain-links/#findComment-1406947 Share on other sites More sharing options...
slyte33 Posted January 20, 2013 Author Share Posted January 20, 2013 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!! Quote Link to comment https://forums.phpfreaks.com/topic/273354-setting-a-time-for-certain-links/#findComment-1407068 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.