through the internal registers R0 and R1. Every animated Object is assigned its own unique set of AMAL registers, but if several Objects are being animated together, several registers may need to be set with exactly the same values. Although this can be achieved by the AMREG function, it is simpler to use a single instruction for changing these registers, affecting a whole batch of Objects simultaneously.
When speed and direction parameters are given after an AMPLAY command, they are loaded in to registers R0 and R1 in the selected channels. The controlling speed of the Object is set by a delay time, given in 50ths of a second, between each movement of the Object. The direction parameter changes the direction of the movement, and is set by one of the following values:
Value Direction of Motion >0 Move the selected Object in the original movement direction 0 Reverse the motion and move the Object backwards -1 Abort movement and jump to next AMAL instruction
Note that either the speed or direction parameters can be omitted, as required.
The AMPLAY command normally affects all current animation channels, but optional start and end points may also be given to set the channel numbers of the first and last Objects to be affected. Here are some examples:
X> Amplay ,0: Rem Reverse objects Amplay 2, : Rem Slow down movement pattern Amplay 3,1 : Rem Set speed to 3 and direction to 1 Amplay ,-1 3 To 6: Rem Stop movement on channels 3,4,5 and 6
CHANAN
function: test a channel for an active animation
value=Chanan(channel number)
This simple function is used to check if the specified animation channel is currently engaged. A value of -1 (true) is returned if the animation is active, otherwise a zero (false) is given if the animation is complete. Here is an example:
E> Load "AMOSPro Tutorial:Objects/Sprites.abk" : Get Sprite Palette Sprite 9,150,150,1 M$="Anim 12,(1,4)(2,4)" Amal 9,M$ : Amal On : Wait Vbl While Chanan(9) Wend Print "Animation complete!"
CHANMV
function: test channel for an active Object
value=Chanmv(channel number)
The CHANMV function is used to check if the Object assigned to the specified channel is currently moving.