Jump to content

[SOLVED] visualize Countdown


DEVILofDARKNESS

Recommended Posts

Okay so I'm building a game, (it's almost finished), but a friend of me said it would be better that if you bought a building or Weapon (on the game) that instead of having the item direct a counter should appear. this one should countdown from a certain time in minutes or houres till zero and you should be possible to see it count down,

 

if you quit the browser the counter actually should go on, so that if you come back it could be build

 

Only one problem: I really have NO idea how I should do this. :s

Link to comment
Share on other sites

One approach would be to store the time of the purchase, and calculate the time it will be "ready" and store that... then, when they were to go to use it, you would check that ready time first to see if it is available for use.

 

You could use javascript to build a countdown timer... and feed it the value of the ready time to countdown to... then if they closed and left, it would just get the ready time from the database and continue counting down upon their return.

 

Hope that helps :)

Link to comment
Share on other sites

Okay I found this javascript

<script language="JavaScript">
TargetDate = "12/31/2020 5:00 AM";
BackColor = "palegreen";
ForeColor = "navy";
CountActive = true;
CountStepper = -1;
LeadingZero = true;
DisplayFormat = "%%D%% Days, %%H%% Hours, %%M%% Minutes, %%S%% Seconds.";
FinishMessage = "It is finally here!";
</script>

 

but how can I pass hte value of php to javascript

TargetDate = <?php echo $targetdate; ?>

???

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.