Gamestudio Links
Zorro Links
Newest Posts
Change chart colours
by 7th_zorro. 05/11/24 09:25
Data from CSV not parsed correctly
by dr_panther. 05/06/24 18:50
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
1 registered members (AndrewAMD), 1,643 guests, and 2 spiders.
Key: Admin, Global Mod, Mod
Newest Members
firatv, wandaluciaia, Mega_Rod, EternallyCurious, howardR
19050 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
REVERSE time counting #168292
11/19/07 21:34
11/19/07 21:34
Joined: Sep 2006
Posts: 188
Latvia
MDI Offline OP
Member
MDI  Offline OP
Member

Joined: Sep 2006
Posts: 188
Latvia
I know how to make timer who works like normal hronometr( withseconds and miliseconds), but how to get this reverse.
This i need for my game, where terrain makes timeout for moving further and in corner shows waiting time.

OK then to you all this is clear - any ideas? because i know when this is possible!


Latvija rullē
Re: REVERSE time counting [Re: MDI] #168293
11/20/07 21:03
11/20/07 21:03
Joined: Sep 2006
Posts: 188
Latvia
MDI Offline OP
Member
MDI  Offline OP
Member

Joined: Sep 2006
Posts: 188
Latvia
OK!! No problem! I think im solve this problem.
Have i say all is possible.


Latvija rullē
Re: REVERSE time counting [Re: MDI] #168294
11/20/07 21:11
11/20/07 21:11
Joined: Jul 2002
Posts: 4,436
Germany, Luebeck
Xarthor Offline
Expert
Xarthor  Offline
Expert

Joined: Jul 2002
Posts: 4,436
Germany, Luebeck
sorry for responding late, and although it seems that you have found a solution I'd like to post a possible solution for people who find this thread using the search function afterwards:

Basicly all you do is first setting the starting time and then subtract from it as long as it is above zero.
My example will use "seconds" as time measurement.
The variable "total_secs" stores the time in seconds which is still left.
My example does not take care of converting this to minutes.
Code:

// !!! Aware: C-Script Code !!!

var total_secs = 0;

function timer_start(_seconds)
{
total_secs = _seconds;

while(total_secs > 0)
{
wait(-1);
total_secs -= 1;
}
}

function timer_stop() //use this function to force the timer to stop
{
total_secs = 0;
}

// Start the timer like this. (example uses 2 minutes as start value)
timer_start(120);



REVERSE time counting [Re: Xarthor] #168295
11/20/07 21:51
11/20/07 21:51
Joined: Sep 2006
Posts: 188
Latvia
MDI Offline OP
Member
MDI  Offline OP
Member

Joined: Sep 2006
Posts: 188
Latvia
Thanks! This is very simple!
I done this in much more complex way - with seconds, miliseconds who use total_ticks and so on!
Although even no needs for something so complex if all can do very simly! OR NOT!


Latvija rullē

Moderated by  HeelX, Lukas, rayp, Rei_Ayanami, Superku, Tobias, TWO, VeT 

Gamestudio download | chip programmers | Zorro platform | shop | Data Protection Policy

oP group Germany GmbH | Birkenstr. 25-27 | 63549 Ronneburg / Germany | info (at) opgroup.de

Powered by UBB.threads™ PHP Forum Software 7.7.1