Action list, delay between functions, and repete # of times.

You must understand the Game Editor concepts, before post here.

Action list, delay between functions, and repete # of times.

Postby Rux » Sat Nov 15, 2008 8:02 pm

How do you make a list of functions, have a delay in between each function, and then repete it a number of times in script?

like this?
Code: Select all
do action
wait 500 ms
do action
200 ms
do action
repeat 2 times
I'm not good at coming up with signatures...
User avatar
Rux
 
Posts: 645
Joined: Sun Apr 29, 2007 9:26 pm
Location: Sitting on your moniter invisable.
Score: 35 Give a positive score

Re: Action list, delay between functions, and repete # of times.

Postby DilloDude » Sat Nov 15, 2008 8:43 pm

Draw Actor:
Code: Select all
//state, loop and counter are any integers.
switch(state)
{
    case 0:
    //action 1;
    state = 1;
    counter  = 0;
    break;

    case 1:
    counter ++;
    if (counter >= 15)//in frames - at 30 fps, 15 frames will be one half a sec
    {
        //action 2
        state= 2;
        counter = 0;
    }
    break;

    case 2:
    state++;
    if(counter >= 6)
    {
        //action 3
        if (loop < 2)//number of times to loop - you can use a variable
        {
            loop ++;
            state = 0;
        }
        else
        {
            state = 3;
        }
    }
}

I use that sort of thing lots. It's good for setting up all sorts of stuff - enemies, switches scenes etc.
Image
User avatar
DilloDude
 
Posts: 866
Joined: Tue Jan 24, 2006 9:51 am
Location: Nyerellion
Score: 58 Give a positive score

Re: Action list, delay between functions, and repete # of times.

Postby j2graves » Sun Nov 16, 2008 11:50 pm

timers work, right?
No games to my name...
User avatar
j2graves
 
Posts: 1302
Joined: Thu Aug 16, 2007 6:42 pm
Location: on the other side of infinity
Score: 19 Give a positive score

Re: Action list, delay between functions, and repete # of times.

Postby DilloDude » Mon Nov 17, 2008 1:10 am

You can use a timer, but It's more convenient to have it all nicely in one script. Also when the game lags and the framerate drops, timers keep real time, wheras a counter still keeps game time.
Image
User avatar
DilloDude
 
Posts: 866
Joined: Tue Jan 24, 2006 9:51 am
Location: Nyerellion
Score: 58 Give a positive score

Re: Action list, delay between functions, and repete # of times.

Postby Kalladdolf » Mon Nov 17, 2008 4:32 am

I've made some bad experiences with timers.
User avatar
Kalladdolf
 
Posts: 2427
Joined: Sat Sep 08, 2007 8:22 am
Location: Germany
Score: 120 Give a positive score

Re: Action list, delay between functions, and repete # of times.

Postby Rux » Tue Nov 18, 2008 12:43 am

I tried timers, but it didnt workout.
I'm not good at coming up with signatures...
User avatar
Rux
 
Posts: 645
Joined: Sun Apr 29, 2007 9:26 pm
Location: Sitting on your moniter invisable.
Score: 35 Give a positive score

Re: Action list, delay between functions, and repete # of times.

Postby BlarghNRawr » Tue Nov 18, 2008 1:25 am

when my FPS randomly changed to 1, th timers stayed the same, 30sec
Download Game Music
current projects:
Bold! ?% Started mechanics
Unnamed puzzle game 60% --i need a name!--
User avatar
BlarghNRawr
 
Posts: 767
Joined: Wed Jun 25, 2008 12:36 am
Location: Not using G-E anymore. Now using Source SDK.
Score: 27 Give a positive score

Re: Action list, delay between functions, and repete # of ti

Postby ProtectionIsland » Mon Jan 21, 2013 10:45 pm

are state, loop and counter all variables?
ProtectionIsland
 
Posts: 1
Joined: Wed Jan 16, 2013 2:09 am
Score: 0 Give a positive score


Return to Advanced Topics

Who is online

Users browsing this forum: No registered users and 1 guest

cron