Countdown timers

Ideas how the game could be improved and suggestions for subsequent versions of the game. (this is just a space for ideas! We can't guarantee suggestions will be implemented!)

Moderator: moderators

Post Reply
Guest

Countdown timers

Post by Guest » 09.10.2011, 20:47

i think kapilands should have some countdown timers for waiting for production or research to finish.
i took the liberty of creating some sample code below!

Code: Select all

<html>
<head>
<script>
/*
 * code by:
 * j3m03d3r
 *
 */

function add_leading_zero(n) {
	if(n.toString().length < 2) {
		return '0' + n;
	} else {
		return n;
	}
}
function countdown(time, out) {
	var hours, minutes, seconds;
	seconds = time % 60;
	minutes = Math.floor(time / 60) % 60;
	hours = Math.floor(time / 3600);
 
	seconds = add_leading_zero( seconds );
	minutes = add_leading_zero( minutes );
	hours = add_leading_zero( hours );
 
	document.getElementById(out).innerHTML = hours + ':' + minutes + ':' + seconds;
 
	if(time < 1) {
		window.location.reload(); //reload if countdown reaches 0
	} else {
		setTimeout("countdown(" + (time - 1) + ", '" + out + "');", 1000);
	}
}
</script>
</head>
<body>
<div id="timer_001"></div>
<script>
countdown(120, 'timer_001');
</script>
</body>
</html> 

Guest

Post by Guest » 09.10.2011, 21:47

I don't really see the added value in replacing the already easy to use 'static' timers with animated ones.

I think it would be rather annoying to see the right side of the screen changing every second.
And, it would become pretty much impossible to copy/paste building process as countdown timers usually won't allow that.

If the programmers wanted it, they would have probably done that already.
Some of the other upjers games do have countdown timers in places where it makes more sense to have them.

Guest

Post by Guest » 10.10.2011, 12:56

maybe just for the things under 10 minutes

Guest

Post by Guest » 10.10.2011, 18:26

Its been a while si nce i used it due to it not working on the latest firefox but i'm sure Kapiskript had live countdown timers. I may be wrong though. :?

Post Reply