Page 1 of 2

Count down timer!

PostPosted: Thu Sep 15, 2005 1:20 pm
by CdaMarinersFan
Okay, I have a game that needs a timer for 5 minutes that counts down to O : 00, and I have 3 actors for the timer: Minute (0), colon (:), and seconds (00). I can get the seconds to count down, but if I use this command:
Minute.textNumber = Minute.textNumber - 1
The Minute ends up going to 0:59 instead of 4:59. And I also tried a variable
if (minutes = 1)...
It did the same thing as well. So anyone please help.

PostPosted: Thu Sep 15, 2005 2:09 pm
by makslane
- Create a timer with 1000ms interval
- Create a variable to hold the time in seconds (total).
- When create the timer, set total = 5*60;
- In the timer event:
Minute.textNumber = (int)(total / 60); //Convert to integer value
Second.textNumber = total % 60;
total--;

PostPosted: Thu Sep 15, 2005 7:43 pm
by CdaMarinersFan
hmmm, a funny message comes up:

Warning: Line 1: Suspicious pointer conversion
Warning: Line 2: Suspicious pointer conversion
Error: Line 3: Cannot apply inc/dec


I dunno about it, I'm really thinking of just making it count up. And I copyed what you typed up.

PostPosted: Thu Sep 15, 2005 9:16 pm
by makslane
Show me your code

PostPosted: Fri Sep 16, 2005 1:10 am
by CdaMarinersFan
Okay, here is my original script for my count down timer:
seconds.textNumber = seconds.textNumber - 1;
if (seconds.textNumber < 0)
{
seconds.textNumber = 59;
Minute.textNumber = Minute.textNumber - 1;
}

There you go, please fix it for me, any way you can so that I don't have to count up. thanks.

PostPosted: Fri Sep 16, 2005 3:25 am
by Chai
ok you want to make Minute and second
so you Created 2 Actor (Second && Minute)

- you created timer in second Actor
- and put the scrip in timer
Code: Select all
seconds.textNumber -=1;

- put this scrip in event/Draw Actor
Code: Select all
if (seconds.textNumber <= 0) {
seconds.textNumber = 59;
Minute.textNumber -= 1;
}


p.s. in 2 actor(Minute && Second )you put the scrip
Code: Select all
seconds.textNumber = 59;
Minute.textNumber = 60;
in Event /Created Actor

PostPosted: Fri Sep 16, 2005 4:18 am
by CdaMarinersFan
Well, Chai, thanks for the tip, but even if I put the p.s code into the Draw Actor Script for the Seconds, it only goes to 4 minutes & 59 seconds.

But the good news is... We got it to 4:59! Not 0:59! :D

...and I just saved a bunch of money on my car insurance by switching to Geico. :D

Now we have to build off of that... thanks again!

PostPosted: Mon Sep 19, 2005 3:54 am
by CdaMarinersFan
Wait, hold on, I still need help getting from 4:59 to 4:58!

PostPosted: Mon Sep 19, 2005 2:30 pm
by makslane
Use this:

Minute.textNumber = (int)(total / 60); //Convert to integer value
Second.textNumber = total % 60;

Will works

PostPosted: Mon Sep 19, 2005 10:59 pm
by CdaMarinersFan
No, it doesn't work, so I think I may just count up

(Halo can do it, TimeSplitters 2 can do it, Mace Griffin Bounty Hunter can do it, how come GE can't count down!)

PostPosted: Tue Sep 20, 2005 12:39 am
by makslane
Look this sample:
http://game-editor.com/examples/count_down_timer.zip

(need the 1.3.2 version to execute)

PostPosted: Tue Sep 20, 2005 1:52 am
by CdaMarinersFan
Uh oh, I only have the 1.2.9 version, and I can't get any more updates.

PostPosted: Wed Sep 21, 2005 12:26 am
by CdaMarinersFan
Uh, Makslane, I still need help here, please... I don't want to be rude if I'm sounding like I am.

PostPosted: Wed Sep 21, 2005 12:31 am
by makslane
Download the 1.3.2 demo, install in a different directory.
Load the demo and see how implement the count down.

You can implement back in your 1.2.9 version.

PostPosted: Wed Sep 21, 2005 1:06 am
by CdaMarinersFan
Thank you! Hopefully this will clear my path up... 4:58 counting down to 0:00, here we come!

Hey, I have a beta version of this game on another topic posting, and I accidently forgot to tell about the controls: Player 1- A=left D=right W=ascend S=fire, Player 2- K=left ;=right O=ascend L=fire, Player 3- Arrows for controls (down is shoot, in case you couldn't figure it out), Player 4 (needs num pad, so have it on)- 4=left 6=right 8=ascend 5=shoot. For suicides for saving your lead or rescuing your ship from some malfunction: Player 1- press Left Shift, Player 2- press Right Shift, Player 3- press End, Player 4- press 3 (on NumPad)

Oh, you'll notice my primitive count-up timer in the upper left corner, I wanted it to go to 300 seconds, but I know better now how to show 5:00 counting up from 0:00, but I have been having a hard time doing it the other way! So thanks for the help!