By assuming that the total width must always be less than 128 pixels, you will not cause any disasters.
Hardware Sprites versus computed Sprites
The greatest problem when using computed Sprites is that you never know precisely which
hardware Sprite is going to be assigned to any particular object! Each computed Sprite can be
instructed from a mixture of hardware Sprites, and the mixture changes every time the object
is moved on the screen.
This can lead to major problems, especially if you need to animate objects that must stay visible in a wide range of Sprite combinations. In these circumstances it is useful to assign a specific group of hardware Sprites to a single object, and the SPRITE command allows you to allocate such Sprites directly by using an identification number between 0 and 7. For Example, the next line allocates hardware Sprite 2 to image number 1, and positions it at coordinates 200,100:
X> Sprite 2,200,100,1
After a Sprite has been grabbed in this way, it will be completely removed from the computed Sprite system, so there will be an inevitable reduction in the number of computed Sprites that can be displayed on screen.
If the required image is wider than 16 pixels, AMOS Professional will automatically assign additional hardware Sprites to this object. These Sprites will be allocated in consecutive order, starting from your original Sprite number.
Look again at the last example line above. Suppose that image number 1 contains a 30 by 20 picture in three colours. The SPRITE command will automatically grab Sprite number 3 as well as number 2, so any future attempt to display Sprite number 3 would fail, because it is already in use. You would then be restricted to assigning hardware Sprites 0,1,4,5,6 and 7 only, and greatly reducing the number of possible computed Sprites.
It is also important to understand that each 15-colour Sprite is actually displayed by using a pair of 3-colour Sprites. The Amiga's hardware allows you to combine matched pairs of Sprites in the following groups only:
0 and 1, 2 and 3, 4 and 5, 6 and 7.
So it is vital to assign 15-colour images to even Sprite numbers, or AMOS Professional will be forced to display your object using the next pair of Sprite numbers, which is a complete waste of a Sprite.
There is a trouble-shooting section at the end of this Chapter, which should answer the most common problems experienced with Sprites. Meanwhile, please load this ready-made program, which demonstrates the advantages of using computed Sprites over Bobs:
D> Load "AMOSPro Tutorials:Tutorials/Sprites_v_Bobs.AMOS"