The Dink Network

Need some help

October 30th 2010, 05:42 AM
custom_skull.gif
Skull
Peasant He/Him Finland bloop
A Disembodied Sod 
Hey, I need some help on this script.

I need a sprite to go through all the sequences it has, and then I need it to go back through all the sequences. I also need this to repeat, so whenever it has gone the sequences through from the first sequence to the last, and then backwards, I need it to start over again. Is there an easy/simple way to do this, cause I can't seem to find one.

Thanks.
October 30th 2010, 07:27 AM
wizardb.gif
Kyle
Peasant He/Him Belgium
 
All the sequences? You mean all the frames?

If you need it to cycle frames, use a variable as a counter that counts up to the maximum number of frames. Then when it reaches the max, let it count back to 1 and repeat. Something like this for a sprite that has 15 frames:

int &counter = 1;
forward:
sp_pframe(&sprite, &counter);
wait(100);
&counter += 1;
if (&counter == 15)
goto backward;

backward:
sp_pframe(&sprite, &counter);
wait(100);
&counter -= 1;
if (&counter == 1)
goto forward;

October 30th 2010, 08:41 AM
custom_skull.gif
Skull
Peasant He/Him Finland bloop
A Disembodied Sod 
Well, I changed it so when &counter hits 11 it will go to backward. It technically works, but only for the first and second frame. The other 9 are left out.
October 30th 2010, 09:31 AM
peasantfr.gif
I think this should solve it, not sure but think you need to make a loop back to forward to keep it continuing and for backward the same. Hope it works.


int &counter = 1;
forward:
sp_pframe(&sprite, &counter);
wait(100);
&counter += 1;
if (&counter == 11)
{
goto backward;
}
else
{
goto forward;
}

backward:
sp_pframe(&sprite, &counter);
wait(100);
&counter -= 1;
if (&counter == 1)
{
goto forward;
}
else
{
goto backward;
}

October 30th 2010, 10:25 AM
wizardb.gif
Kyle
Peasant He/Him Belgium
 
Yep I forgot about that part. But you don't need to use an else clause there. You can simply add goto forward after goto backward because it will never reach there if the if conditional returns true