Need some help
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.
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.
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:
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;
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.
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; }