5 Animation With Player/Missile Graphics

Extending Player/Missile Graphics

Eric Stoltman

Here's another way to animate player shapes with a machine language routine. It's also valuable for instantly changing the shape of a player to fit the direction it's traveling.

One of the best features of the Atari is player/missile graphics. This article and example program will explain how to create excellent animation, such as a walking figure or a rotating ship, with just one player.

One way to perform animation is to alternate players back and forth, but problems arise. What if the player is moved up? The other players also have to be moved up. This takes time. Another method is to alternately POKE data into the player, thus changing its shape. This can be done slowly in BASIC or quickly and easily in machine language. This program will compare both the BASIC and machine language methods for changing the data of a player.

After a player is set up, additional data for other shapes must be stored in RAM. I prefer to use memory locations 256 to 511, since they are empty and are protected. This data can be manipulated by setting up pointers in an array. A subroutine can then easily retrieve this data and place it in the player's data area. This can be done in BASIC:

POINTER(FACING)=Array containing addresses of data.
EXAMPLE: POINTER(1)=260,POINTER(2)=268, etc.

Or in machine language:


XXX = Address of Machine Language subroutine. The machine language method is not only easier, but also executes 11 times faster and provides smoother motion.

The machine language code is relocatable and can easily be modified by changing the 22nd DATA element so more or less data can be POKEd into the player's data area.

In addition to providing animation, this subroutine can move a player up or down when the vertical value changes greatly. To do this, point to an empty area of RAM (thus erasing the player), and then change the vertical value and point to the desired data. An example would be if a player went off the top of the screen and, using the method mentioned above, quickly reappeared at the bottom.

I should point out that many false players, that is, data for alternate shapes, may be stored and rotated among the four players to provide excellent animation.

Line Numbers   Explanation
110-130	         POKE machine language subroutine for changing player into player.
140-170          POKE data for additional shapes into memory.
180-190          Set up pointers to data.
200-250          Set up player.
270-330          If trigger is pressed, change player by machine language.
340-400          If trigger is not pressed, change player by BASIC.

Download (Saved BASIC)
Download / View P186L1.LST (Listed BASIC)

Return to Table of Contents | Previous Section | Next Section