This Chapter explains the theory behind the AMOS Professional system for updating and drawing moving objects. As well as a comprehensive range of commands, a completely automatic system is provided for your use.
Moving multiple objects
As a default condition, AMOS Professional manages the position of each and every object on the
screen automatically. The moment that the coordinates of these objects change, they are re-
drawn almost instantly. When it comes to programming complex arcade games, that "almost
instantly" can cause problems!
The next two ready-made programs demonstrate a typical problem, first with Sprites and then with Bobs. If you examine them, you will see that the objects are moving at slightly irregular times, because even though AMOS Professional is updating their positions at regular intervals, it is not keeping pace with the FOR ... NEXT loop.
To avoid wobbly Sprites and Bobs, all objects must be re-drawn at the same instant in your program, and AMOS Professional provides three commands for this purpose. SPRITE UPDATE, is to be used for updating Sprites, BOB UPDATE displays Blitter Objects and the UPDATE command re-draws both Sprites and Bobs in the same operation.
Before calling any of these commands, the automatic updating system must be disengaged using the relevant command, SPRITE UPDATE OFF, BOB UPDATE OFF or UPDATE OFF, as appropriate. Here are two working examples to type in yourself:
E> Load "AMOSPro_Tutorial:Objects/Sprites.Abk" Curs Off : Flash Off : Cls 0 Set Sprite Buffer 256 Hide On Get Sprite Palette Sprite Update Off For X=X Hard(0) To X Hard(330) For S=0 To 8 Sprite S+8,X,S*25+50,2 Next S Sprite Update : Wait Vbl Next X E> Load "AMOSPro Tutorial:Objects/Bobs.Abk" Curs Off : Flash Off : Cls 0 Double Buffer Get Bob Palette Bob Update Off For X=0 To 330 For B=0 To 1 Bob B,X,B*90,2 Next B Bob Update Wait Vbl Next X