›*******+++++++++*********+++++++++****›› DOING P/M GRAPHICS IN BASIC XE› By Bruce Pleat› SySop› Mister Message BBS› (516) 454-7698››(former member of the OL' HACKERS›ATARI USER GROUP, Inc.)›››To turn on PMG in BASIC XE, you first›set a GRAPHICS mode, then do a›PMGRAPHICS for the "mode" you want.›Youcan have three modes:›› 0 Turn PMG OFF› 1 "Single-Line" Resolution› 2 "Dougle-Line" Resolution››"1" means you use 2 times as much›RAM(2048 bytes) and have two times as›much detail. "2" means 1024 bytes are›used and each line is the height of a›GR.7 line, instead of PMG mode 1's›GR.8 height. To set the›player/missile COLORs, you use the›PMCOLOR #,color,hue command.››The PMWIDTH command allows you to›define the WIDTH of players...you have›SINGLE-width( 1 player is eight GR.7›pixels), DOUBLE-width(1=16 in GR.7)›and QUADRUPLE(1 player=32 GR.7›pixels). The wider the player, the›lower the resolution,and yet of course›the larger it is in WIDTH.››PMCLR # clears the player/missile›space of playernumber #. Doing 4-7›for # which usually selects the›missile compliment for players 0-3 in›thiscommand clears them all.››HITCLR checks for collisions. It has›no parameters and you can use it right›before you wish to check for›collisions via the BUMP command:›› BUMP(panum,aexp) is used as›such:›› IF BUMP(4,1) THEN GOTO...››Bump Parameters:›Players 0-3: 0-3›Missiles 0-3: 4-7›Playfield 0-3: 8-11››Now, the only VALID bumps are:››Player to player: BUMP(0-3,0-3) (If›first parm=second, 0 is always›returned; a player can't hit itself!)›Missile to Player: BUMP(4-7,0-3)›Player to Colors: BUMP(0-3,8-11)›Missile to Colors: BUMP(4-7,8-11)››Now to define or move a MISSILE you›use:››MISSILE #,X,Y (where X,Y do not›correspond to GR.7 or whatever mode's›X,Y).››To move a PLAYER:››PMMOVE panum [,absleft] [absvert]››Panum is player #0-3, absleft is the›player's left bit's LEFT POSITION [Y].› It can range from 0-255 but the›lowest and highest are off the edges.››Absvert is the vertical DISPLACEMENT›from its LAST position. (For example,›X=X+1, SET 7,1 - lets players that›might go off the top/bottom›wrap-around to the other side. SET›7,0 [default] just loses them.››PMADR(#) gives the ADDRESS of a›player's top. That's where you POKE,›BGET, MOVE, or otherwise store the›player's data.››Draw your object. Then, redraw it on›graph paper in no more than eight›boxes wide and 30 high(more is too›big). Then, put the following numbers›on top of each column from LEFT to›right:›› 1 2 4 8 16 32 64 128››Now, add up the "on" or colored-in›column values and place them to the›side of the line they're added up for.› When you've done that, place those›values into a DATA line. Now, do the›GRAPHICS mode you want, and any›drawings you want to do and any colors›you wish to set.››Set the Player/Missile Colors via›direct POKEs or PMCOLOR commands. Set›your PMGRAPHICS mode and then your›PMWIDTH. "1" is best for starters.›You set it for EACH player/missile you›want to use. Do a PMCLR for players›0-3 and then one for missiles, #4 to›make it simple. Do a RESTORE to your›DATA line for your PLAYER 0. Now do›the following:›› FOR A=1 TO (# of lines in›Player)› READ B:POKE PMADR(0)+A,B› NEXT A››Repeat the RESTORE through NEXT A›sequence for each player ONLY. Set›the missiles with this routine:›› FOR A=1 TO ....› READ B:POKE›PMADR(0)+A,PEEK(PMADR(0)+A)!(2^player+›):NEXT A››PMMOVE each player where you want it.›MISSILE each missile where you want›it. And, HITCLR the screen.››Jump out of your set-up routine›[PROCEDURE??) and into the main one›which can do the following:››PMMOVE a player›MISSILE a missile (getting tired of›that...)›HITCLR:BUMP ....(always a HITCLR right›after a BUMP) to check for collision››Oh, the Missile and Player vertical›movement (OFFSETs) are perfect for the›VSTICK command!!›› #########%%%%%%%%########%%%%%%%%####›