Wait

The wait alteration isn't an alteration so much as a timing device. When applied to a sprite it will trigger a completion event after the given amount of milliseconds. One convenient method of timing a whole animation sequence is to have a sprite contain several wait alterations. This is actually easier to read and work with than having one event trigger the next. Also, in the example notice the 'sub' method to abbreviate coding.

create routine as Start launch bkgrd launch ship end create sprite from background.jpg as bkgrd having alt=(sub create wait as w1 where delay=1000 and completion=w1Done end) alt=(sub create wait as w2 where delay=3000 and completion=w2Done end) alt=(sub create wait as w3 where delay=5000 and completion=w3Done end) end create sprite from attacker5.png as ship where center=40,20 and x=50 and y=50 and angle=300 end create routine as w1Done insert into ship where alt=(sub create vector as v1 where speed=100 end) end create routine as w2Done insert into ship where alt=(sub create rotation as r1 where speed=400 and destination=70 end) end create routine as w3Done remove from ship where alt=v1 end

Parameters

delay={number}
number of milliseconds to pass before triggering the completion event. The timer starts when the alteration is added to the sprite or the sprite is launched
repeat={number|forever}
can specify the number of iterations that the wait should occur, or mark it to repeat it forever. The completion routine will be called after each iteration and the _repeat value in the routine will be set to which iteration this is, starting at 1.
completion={routine}
specify a routine to run when the timer delay is reached

Pausing a wait

A wait can be paused and unpaused in a routine:

pause wait WaitName unpause wait WaitName

To use pause/unpause the 'wait' must have a name. Therefore it cannot be anonymous, and it cannot be an unnamed clone.