Sequence Changes
I have a sprite, on a brain 6 (repeat) doing nothing but just that, repeating. I want (randomly) for this sprite to change to another sequence for 1 whole sequence run and then revert to it's old sequence. If that makes sense, here's some code I tried to use:
My problem is knowing when to redraw the original sprite, as I can't figure out an exact length of the new sequence, and the wait command is always a little off on different machines.
Suggestions?
void main( void ) { int &how_long; int &myrand; int &fake_aviarn; mainloop: &how_long = random(5000, 1000); &myrand = random(3, 1); if (&myrand == 1) { sp_nodraw(¤t_sprite, 1); &fake_aviarn = create_sprite(180, 139, 7, 37, 1); sp_seq(&fake_aviarn, 37); sp_nodraw(¤t_sprite, 0); } wait(&how_long); goto mainloop; }
My problem is knowing when to redraw the original sprite, as I can't figure out an exact length of the new sequence, and the wait command is always a little off on different machines.
Suggestions?
April 9th 2010, 12:56 AM

Sparrowhawk


I don't think there's a way to tell when a sequence has finished (unfortunately), you can either try timing a wait which is dodgy as you said or I usually work around problems like this by 'faking' the sequence.
Instead of sp_seq use this:
Instead of sp_seq use this:
sp_pframe(&sprite, 1); wait(50); sp_pframe(&sprite, 2); wait(50); sp_pframe(&sprite, 3); wait(50); sp_pframe(&sprite, 4); wait(50); sp_pframe(&sprite, 5);
Yeah, not a bad idea. Just a little tedious and messy.
I was hoping there was someway of timing the sequence end and performing a task, but I guess not.
That should work, though, Sparrow.
I was hoping there was someway of timing the sequence end and performing a task, but I guess not.
That should work, though, Sparrow.