'=========================================================================== ' Subject: ANIMATION DEMO W/PAC-MAN Date: 04-28-97 (19:09) ' Author: Denis Boyles Code: QB, QBasic, PDS ' Origin: FidoNet QUIK_BAS Echo Packet: GRAPHICS.ABC '=========================================================================== '-=[PACANIME.BAS=- v1.00 Public Domain (pd) 1997 by Denis Boyles ' 'Microsoft QBASIC v1.1 '~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ' This program demonstrates the following concepts: transparent sprites and ' flicker free animation. The animation is done by using multiple video pages ' in MODE 7. However it can be slow in QBASIC and you can't readily apply ' this to MODE 13. (256 colors) Since that mode only supports one video page ' as standard, you would need to resort to a separate buffer. (or try ModeX) ' DECLARE SUB DrawFrame (iX%, iY%, iClr%, iFrm%, iFlp%) DECLARE SUB SetFrame (iFrm%) DECLARE SUB SetBackGround () CONST PacColor = 14 CONST YPos = 100 DIM SHARED LN$(16) x% = 0: xDlt% = 3 frm% = 0: FrmDlt% = 1 flp% = 0 SetBackGround WHILE INKEY$ = "" DrawFrame x%, YPos, PacColor, frm%, flp% x% = x% + xDlt% frm% = frm% + FrmDlt% IF frm% = 0 OR frm% = 2 THEN FrmDlt% = -FrmDlt% IF x% <= 0 OR x% >= 303 THEN xDlt% = -xDlt% flp% = NOT flp% END IF WEND SCREEN 0, 0 WIDTH 80 SUB DrawFrame (iX%, iY%, iClr%, iFrm%, iFlp%) SCREEN 7, , 1, 0 PCOPY 2, 1 SetFrame iFrm% FOR y% = 0 TO 15 FOR x% = 0 TO 15 IF MID$(LN$(y%), x% + 1, 1) = "#" THEN IF iFlp% THEN PSET (iX% + 16 - x%, y% + iY%), iClr% ELSE PSET (iX% + x%, y% + iY%), iClr% END IF END IF NEXT NEXT WAIT &H3DA, 8 PCOPY 1, 0 END SUB SUB SetBackGround SCREEN 7, , 2, 0 FOR ct% = 0 TO 199 LINE (0, ct%)-(319, ct%), ct% MOD 16 NEXT END SUB SUB SetFrame (iFrm%) SELECT CASE iFrm% CASE 0 LN$(0) = " ###### " LN$(1) = " ########## " LN$(2) = " ############ " LN$(3) = " ### ######### " LN$(4) = " ### ######## " LN$(5) = "################" LN$(6) = "################" LN$(7) = "################" LN$(8) = "################" LN$(9) = "################" LN$(10) = "################" LN$(11) = " ############## " LN$(12) = " ############## " LN$(13) = " ############ " LN$(14) = " ########## " LN$(15) = " ###### " CASE 1 LN$(0) = " ###### " LN$(1) = " ########## " LN$(2) = " ############ " LN$(3) = " ### ######### " LN$(4) = " ### ######## " LN$(5) = "############## " LN$(6) = "############ " LN$(7) = "########## " LN$(8) = "######## " LN$(9) = "########## " LN$(10) = "############ " LN$(11) = " ############# " LN$(12) = " ############## " LN$(13) = " ############ " LN$(14) = " ########## " LN$(15) = " ###### " CASE 2 LN$(0) = " ###### " LN$(1) = " ########## " LN$(2) = " ############ " LN$(3) = " ### ####### " LN$(4) = " ### ##### " LN$(5) = "########### " LN$(6) = "########## " LN$(7) = "######### " LN$(8) = "######## " LN$(9) = "######### " LN$(10) = "########## " LN$(11) = " ########## " LN$(12) = " ########### " LN$(13) = " ########### " LN$(14) = " ########## " LN$(15) = " ###### " END SELECT END SUB