CREATIVE PROGRAMMING WITH PLAYER/MISSLE GRAPHICS
A simple way to add color
SYNOPSIS
This article explains how to use Player/Missle graphics in non-standard ways. The accompanying program runs on all Atari computers. 16K RAM and BASIC are required.
Most of us have seen games that use Player/Missile graphics (PMG). This sophisticated graphics system, built into all Atari computers, allows you to create and animate small figures, and to move them across the screen withott disturbing the background.
However, PMG have useful applications other than games. For instance, there are many data-processing programs that use only the text screen of Graphics 0. You can spice up such a program with color very easily using PMG. The following program listing shows you how to accomplish this without resorting to the use of display-list interrupts or other fancy techniques.
PROGRAM DESCRIPTION
Line 5 turns off the cursor. To turn it back on, poke 752,0. Line 7 passes control to a subroutine that starts at line 500. Line 500 POKEs a number into memory location 623, which is known as GPRIOR, or the priority selection register. Priority, in PMG parlance, refers to which image appears (has priority) when two or more images occupy the same area of the screen. By POKEing a one into GPRIOR, we tell the Atari to display all players in front of all playfields. A "player" is a graphic image created with PMG; "playfield" refers to a screen image created by means other than PMG.
GPRIOR also enables us to combine four missiles, or two-bit-wide players, into a fifth player. We accomplish this by adding 16 to the number POKEd into GPRIOR.
QUADRUPLE WIDTH
Line 505 sets all players to quadruple width (32 bits) by POKEing each player-width register with three. We use quadruple width to highlight a large area ofthe screen. Line 507 dues the same thing with the missiles.
Lines 510 through 518 set all players to the same color. By doing this and positioning the players side by side, we can cover the entire screen with what appears to be a single giant player. Line 560 makes player 0 (the first player) into a solid column that runs the height of the screen by POKEing location 53261 with 255. Binary for 255 is 11111111, so the player appears to be a solid bar. Experiment with this effect by POKEing different numbers into location 53261. This is the only way you can define an entire player with one byte. For instance, POKE 53261,129 to create a player that looks like two vertical stripes. Lines 570 through 582 do the same thing for the other players.
That's all there is to this simplified PMG setup. Note that you don't have to worry about things like Player/Missile data structure, or where to reserve memory for the data. When you want to simply add color to a text or graphics screen, this simple system is probably the best.
MULTICOLORED PLAYERS
Line 292 shows you how to use GPRIOR (location 623) to create multi-colored players. To implement this, POKE 623,PEEK(623)+32. Now, when you overlap two players, a third color appears in the area of overlap. This is how arcade-game designers create multicolored players.
The program that accompanies this article is reprinted from Philip Seyer's Atari Player Missile Graphics, Reston Publishing Co. (1984), Reston, VA, (703)437-8900. Philip Seyer writes on educational topics, and is currently workin full-time on Atari books and programs.
Listing: GR0PM.BAS Download