Jump to content


Photo

Setting a time()+? for certain links


  • Please log in to reply
2 replies to this topic

#1 slyte33

slyte33

    Advanced Member

  • Members
  • PipPipPip
  • 137 posts

Posted 19 January 2013 - 06:52 AM

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:

Posted Image



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.

#2 Barand

Barand

    Sen . ( ile || sei )

  • Gurus
  • 14,133 posts
  • LocationCheshire, UK

Posted 19 January 2013 - 12:33 PM

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

|baaGrid| easy data tables - and more
|baaChart| easy line, column and pie charts
|baaSelect| generate js and php code for dynamic linked dropdowns

 


#3 slyte33

slyte33

    Advanced Member

  • Members
  • PipPipPip
  • 137 posts

Posted 20 January 2013 - 08:14 AM

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




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users

Cheap Linux VPS from $5
SSD Storage, 30 day Guarantee
1 TB of BW, 100% Network Uptime

AlphaBit.com