The Dink Network

Reply to Re: Two loops at the same time

If you don't have an account, just leave the password field blank.
Username:
Password:
Subject:
Antispam: Enter Dink Smallwood's last name (surname) below.
Formatting: :) :( ;( :P ;) :D >( : :s :O evil cat blood
Bold font Italic font hyperlink Code tags
Message:
 
 
March 29th 2010, 02:39 PM
slimeg.gif
metatarasal
Bard He/Him Netherlands
I object 
Sure, just make sure that both loops are in different scripts.

Something like this:

Wizard's script:

void main(void)
{
&global = &current_sprite;
spawn("fireloop");
loop:
move_stop(&current_sprite,4,x,1);
move_stop(&current_sprite,6,x,1);
goto loop;
}


Fireloop.c:

void main(void)
{
script_attach(0);
int &wizx;
int &wizy;
int &sprite;
loop:
&wizx = sp_x(&global,-1);
&wizy = sp_y(&global,-1);
&sprite = create_sprite(&wizx,&wizy,brain,seq,frame);
//Fire fireball
goto loop;
}


Note: scripts have not been tested, use at own risk.
EDIT: Also, there are ways of doing this without using a global variable, but generally I use some 'general purpose globals' that can be used whenever I feel like it on a specific screen.