Count down timer!

Talk about making games.

Count down timer!

Postby CdaMarinersFan » Thu Sep 15, 2005 1:20 pm

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.
Image
User avatar
CdaMarinersFan
 
Posts: 109
Joined: Wed May 11, 2005 11:20 pm
Score: 0 Give a positive score

Postby makslane » Thu Sep 15, 2005 2:09 pm

- 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--;
makslane
Site Admin
 
Posts: 3947
Joined: Sat Apr 05, 2003 6:47 pm
Score: 182 Give a positive score

Postby CdaMarinersFan » Thu Sep 15, 2005 7:43 pm

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.
Image
User avatar
CdaMarinersFan
 
Posts: 109
Joined: Wed May 11, 2005 11:20 pm
Score: 0 Give a positive score

Postby makslane » Thu Sep 15, 2005 9:16 pm

Show me your code
makslane
Site Admin
 
Posts: 3947
Joined: Sat Apr 05, 2003 6:47 pm
Score: 182 Give a positive score

Postby CdaMarinersFan » Fri Sep 16, 2005 1:10 am

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.
Image
User avatar
CdaMarinersFan
 
Posts: 109
Joined: Wed May 11, 2005 11:20 pm
Score: 0 Give a positive score

Postby Chai » Fri Sep 16, 2005 3:25 am

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
User avatar
Chai
 
Posts: 361
Joined: Sat Apr 30, 2005 2:26 pm
Location: Thailand
Score: 30 Give a positive score

Postby CdaMarinersFan » Fri Sep 16, 2005 4:18 am

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!
Image
User avatar
CdaMarinersFan
 
Posts: 109
Joined: Wed May 11, 2005 11:20 pm
Score: 0 Give a positive score

Postby CdaMarinersFan » Mon Sep 19, 2005 3:54 am

Wait, hold on, I still need help getting from 4:59 to 4:58!
User avatar
CdaMarinersFan
 
Posts: 109
Joined: Wed May 11, 2005 11:20 pm
Score: 0 Give a positive score

Postby makslane » Mon Sep 19, 2005 2:30 pm

Use this:

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

Will works
makslane
Site Admin
 
Posts: 3947
Joined: Sat Apr 05, 2003 6:47 pm
Score: 182 Give a positive score

Postby CdaMarinersFan » Mon Sep 19, 2005 10:59 pm

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!)
User avatar
CdaMarinersFan
 
Posts: 109
Joined: Wed May 11, 2005 11:20 pm
Score: 0 Give a positive score

Postby makslane » Tue Sep 20, 2005 12:39 am

Look this sample:
http://game-editor.com/examples/count_down_timer.zip

(need the 1.3.2 version to execute)
makslane
Site Admin
 
Posts: 3947
Joined: Sat Apr 05, 2003 6:47 pm
Score: 182 Give a positive score

Postby CdaMarinersFan » Tue Sep 20, 2005 1:52 am

Uh oh, I only have the 1.2.9 version, and I can't get any more updates.
Image
User avatar
CdaMarinersFan
 
Posts: 109
Joined: Wed May 11, 2005 11:20 pm
Score: 0 Give a positive score

Postby CdaMarinersFan » Wed Sep 21, 2005 12:26 am

Uh, Makslane, I still need help here, please... I don't want to be rude if I'm sounding like I am.
Image
User avatar
CdaMarinersFan
 
Posts: 109
Joined: Wed May 11, 2005 11:20 pm
Score: 0 Give a positive score

Postby makslane » Wed Sep 21, 2005 12:31 am

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.
makslane
Site Admin
 
Posts: 3947
Joined: Sat Apr 05, 2003 6:47 pm
Score: 182 Give a positive score

Postby CdaMarinersFan » Wed Sep 21, 2005 1:06 am

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!
Image
User avatar
CdaMarinersFan
 
Posts: 109
Joined: Wed May 11, 2005 11:20 pm
Score: 0 Give a positive score

Next

Return to Game Development

Who is online

Users browsing this forum: No registered users and 1 guest