Page 1 of 1

need Help please!!

PostPosted: Mon Jul 16, 2007 10:18 pm
by XXGamexGodXX
I want to make a countDOWN timer...could someone please show me how to do this

PostPosted: Tue Jul 17, 2007 12:28 am
by d-soldier
You cloud create a text actor and in it's create actor script put:
textNumber = 30;
and add a createtimer event for every 1000 ms (which would be 1 second)
then in the timer event for that timer put:
textNumber -= 1;

and in the text actor's draw actor event put:
if(textNumber == 00)
{
insert what you want to happen here;
}

Also, follow the forum rules and avoid using subject titles like "need help!" and such so people searching the forum can tell what each topic is about without having to click on it.

PostPosted: Tue Jul 17, 2007 12:33 am
by Jay S.
Create an integer Variable called "count" and set it to how many seconds you want the player to have. Example:
Code: Select all
count=100;

Then, on a Create Actor event for an actor, select "Create Timer." Assuming you want your timer to count down in seconds, make "Time (ms)" 1000, and set "Repeat" to "Specify Quantity" and have "Count" to 1. Now, on a "Timer" event for the actor, select your timer and then in Script Editor type:
Code: Select all
count-=1;

Now on a Draw Actor event for an actor, type in Script Editor:
Code: Select all
if(count<=0)
{
    //your actions here...
}


If you would like to have the player see how many seconds they have left, create a text actor and in Draw Actor event for this actor, type in Script Editor:
Code: Select all
text_actor.textNumber=count;


EDIT: d-soldier beat me. :roll:

:lol:

PostPosted: Tue Jul 17, 2007 1:51 am
by d-soldier
I beat you sure, but I think your way is probably better. :D

PostPosted: Tue Jul 17, 2007 2:35 am
by XXGamexGodXX
okay i will keep the rules in mind...and thank you for the help

Re: need Help please!!

PostPosted: Mon Jun 09, 2008 11:32 pm
by paperboy321
d-soldier I am making a game where you have a score and a timer countdown. You have to push the right arrow key as many times as you can before the timer goes to zero. I followed your instructions and it worked.I set the timer for 15 sec, I want the key down(the right key ) to be disabled when the timer reaches zero, but you can still push the right arrow key to get more points. Can you tell me how to disable the ability to push the right arrow key (get more points).

Re: need Help please!!

PostPosted: Mon Jun 09, 2008 11:35 pm
by Caaz Games
this was posted like a year ago and i dont thing dsd gets online here anymore.

Re: need Help please!!

PostPosted: Tue Jun 10, 2008 12:04 am
by paperboy321
:( yeah I know

Re: need Help please!!

PostPosted: Tue Jun 10, 2008 2:38 am
by DST
simple way: multiplier.
Multiplier is a very simple way to enable/disable without using a lot of code. Create another variable, and use it on your scoring. You don't need to use count variable in that manner either. All you need is the timer.

Like this

KeyDown>KeyRight
Code: Select all
Score+=value*enable;


That sure was simple, eh?

So score is your score variable, the one that your text actor will display. Value is how many points the player scores each time he hits the right key. and enable is a variable that's either 1 or 0. You set it to 1 whenever you want the player to be able to use keydown>keyright.

And on the timer
Code: Select all
enable=0;


Technically the player can still push right, and get a score, but the points are worth 0.

Of course if you have other actions on key right, and you want to disable them all, then you can still use if (enable>0){};

Same effect.

But the nice thing about the multiplier is you can use it for bonuses. Like if a player gets 10 in a row, points suddenly are worth double.