'=========================================================================== ' Subject: RPG CHARACTER Date: 04-21-94 (17:20) ' Author: Robert Fisher Code: QB, QBasic, PDS ' Origin: mhscards@aol.com Packet: GRAPHICS.ABC '=========================================================================== 'This LESSON demonstrates animation on a small scale. 'The smaller the image you wish to animate, the faster 'the speed of animation. You will see a portrait of a 'typical character you would find in an RPG game. The 'character's face is void of eyes and a mouth. When a 'charcter talks, the eyes and lips are animated to 'simulate speech. Below the portrait, you will see 'four sets of eyes & mouth. We then GET these very 'small images and use the PUT command to place them on 'the blank face. We use the RAN(dom) command to determine 'which facial features will be selected. There is a 'timing loop to slow the animation down. You can adjust 'this loop to decrease/increase the speed to suit your 'particular PC processor speed. All the DATA statements 'in this program merely represent individual pixels of 'different colors. This particular RPG character is from 'the 'MIGHT & MAGIC' game by New World Computing. 'The four positions of the mouth are: Closed, 1/3 open, '2/3 open and 3/3 open. The three positions of the eyes 'are Open, Closed, and Raised Eyebrows. ' CLS : RANDOMIZE TIMER SCREEN 13: CLS : DEF SEG = &HA000 DIM M1%(300), M2%(300), M3%(300), M4%(300) DIM E1%(300), E2%(300), E4%(300) VGACOLORS: C = -1: FOR N = 1 TO 768 STEP 3 C = C + 1: READ B, G, R CL = (R * 256 ^ 2) + (G * 256) + B PALETTE C, CL: NEXT N READPICDATA: FOR I = 1 TO 30: FOR J = 1 TO 30 READ N: PSET (X1, Y1), N: X1 = X1 + 1 NEXT J: X1 = 0: Y1 = Y1 + 1: NEXT I Y1 = 39: X1 = 7: H1 = 7 READEYES01: FOR I = 1 TO 6: FOR J = 1 TO 16 READ N: PSET (X1, Y1), N: X1 = X1 + 1 NEXT J: X1 = H1: Y1 = Y1 + 1: NEXT I Y1 = 48: X1 = 11: H1 = 11: GET (7, 39)-(22, 44), E1% PUT (67, 39), E1%, PSET READMOUTH01: FOR I = 1 TO 8: FOR J = 1 TO 8 READ N: PSET (X1, Y1), N: X1 = X1 + 1 NEXT J: X1 = H1: Y1 = Y1 + 1: NEXT I Y1 = 39: X1 = 37: H1 = 37: GET (11, 48)-(18, 55), M1% READEYES02: FOR I = 1 TO 6: FOR J = 1 TO 16 READ N: PSET (X1, Y1), N: X1 = X1 + 1 NEXT J: X1 = H1: Y1 = Y1 + 1: NEXT I Y1 = 48: X1 = 41: H1 = 41: GET (37, 39)-(52, 44), E2% READMOUTH02: FOR I = 1 TO 8: FOR J = 1 TO 8 READ N: PSET (X1, Y1), N: X1 = X1 + 1 NEXT J: X1 = H1: Y1 = Y1 + 1: NEXT I Y1 = 48: X1 = 71: H1 = 71: GET (41, 48)-(48, 55), M2% READMOUTH03: FOR I = 1 TO 8: FOR J = 1 TO 8 READ N: PSET (X1, Y1), N: X1 = X1 + 1 NEXT J: X1 = H1: Y1 = Y1 + 1: NEXT I Y1 = 39: X1 = 97: H1 = 97: GET (71, 48)-(78, 55), M3% READEYES04: FOR I = 1 TO 6: FOR J = 1 TO 16 READ N: PSET (X1, Y1), N: X1 = X1 + 1 NEXT J: X1 = H1: Y1 = Y1 + 1: NEXT I Y1 = 48: X1 = 101: H1 = 101: GET (97, 39)-(112, 44), E4% READMOUTH04: FOR I = 1 TO 8: FOR J = 1 TO 8 READ N: PSET (X1, Y1), N: X1 = X1 + 1 NEXT J: X1 = H1: Y1 = Y1 + 1: NEXT I GET (101, 48)-(108, 55), M4% TALKINGHEAD: LINE (1, 30)-(175, 60), 0, BF DO: T = INT(RND * 4) + 1: ON T GOTO F1, F2, F3, F4 F1: PUT (7, 9), E1%, PSET: PUT (11, 18), M1%, PSET: GOTO F5 F2: PUT (7, 9), E2%, PSET: PUT (11, 18), M2%, PSET: GOTO F5 F3: PUT (7, 9), E1%, PSET: PUT (11, 18), M3%, PSET: GOTO F5 F4: PUT (7, 9), E4%, PSET: PUT (11, 18), M4%, PSET F5: FOR I = 1 TO 500: NEXT I LOOP UNTIL INKEY$ <> "" END PALETTEDATA: DATA 00,00,00,31,31,31,60,60,60,58,58,58,56,56,56,53,53,53 DATA 51,51,51,49,49,49,47,47,47,44,44,44,42,42,42,40,40,40 DATA 37,37,37,35,35,35,33,33,33,63,63,63,29,29,29,27,27,27 DATA 25,25,25,23,23,23,21,21,21,19,19,19,17,17,17,15,15,15 DATA 13,13,13,11,11,11,09,09,09,07,07,07,05,05,05,03,03,03 DATA 01,01,01,00,00,00,63,58,58,62,53,53,61,48,48,60,44,44 DATA 59,40,40,58,35,35,57,31,31,57,27,27,56,23,23,55,19,19 DATA 54,16,16,53,12,12,52,08,08,51,05,05,50,02,02,50,00,00 DATA 46,00,00,42,00,00,38,00,00,33,00,00,29,00,00,25,00,00 DATA 21,00,00,17,00,00,13,00,00,63,29,00,55,25,00,48,22,00 DATA 40,18,00,33,15,00,25,11,00,18,08,00,63,63,54,63,63,46 DATA 62,63,38,62,63,30,62,63,22,61,63,14,61,63,06,59,61,00 DATA 59,59,00,56,55,00,53,51,00,50,46,00,47,42,00,44,38,00 DATA 41,34,00,38,31,00,34,26,00,30,22,00,26,18,00,22,15,00 DATA 18,11,00,14,08,00,10,05,00,06,03,00,54,63,22,49,59,17 DATA 45,56,13,41,52,10,37,49,06,33,45,03,29,42,01,26,39,00 DATA 21,36,00,19,33,00,18,31,00,17,29,00,16,27,00,14,25,00 DATA 13,23,00,12,21,00,11,19,00,47,62,47,39,60,38,32,58,31 DATA 23,56,23,16,55,16,11,53,10,10,50,09,08,47,08,07,45,07 DATA 06,42,06,05,39,04,04,36,04,03,34,03,02,31,02,02,28,02 DATA 01,26,01,01,23,01,01,20,00,00,17,00,00,15,00,00,12,00 DATA 00,09,00,00,07,00,60,60,63,56,56,63,51,51,63,47,47,63 DATA 43,44,63,39,40,63,35,35,63,31,32,63,27,28,63,23,24,63 DATA 19,20,63,15,16,63,11,12,63,07,08,63,03,04,63,00,01,63 DATA 00,00,63,00,00,59,00,00,55,00,00,51,00,00,47,00,00,43 DATA 00,00,39,00,00,36,00,00,32,00,00,28,00,00,24,00,00,20 DATA 00,00,16,00,00,12,00,00,08,00,00,05,60,54,63,57,46,63 DATA 54,39,63,52,31,63,50,23,63,47,16,63,45,08,63,42,00,63 DATA 38,00,57,32,00,50,27,00,43,21,00,35,15,00,27,10,00,20 DATA 06,00,12,02,00,05,51,63,63,45,59,59,39,56,56,34,53,53 DATA 29,50,50,25,47,47,20,43,43,17,40,40,13,36,36,09,31,31 DATA 07,27,27,04,23,23,02,19,19,01,15,15,00,11,11,00,07,07 DATA 58,60,62,54,58,61,49,55,61,45,53,61,41,51,60,37,49,60 DATA 33,48,60,29,46,59,25,44,59,21,43,59,17,41,58,13,40,58 DATA 10,38,58,06,37,57,02,36,57,01,33,54,01,31,51,00,29,48 DATA 00,27,45,00,25,43,00,23,40,00,21,37,00,20,34,00,18,31 DATA 00,16,28,00,14,24,00,12,21,00,10,18,00,08,15,00,06,12 DATA 00,05,09,00,03,06,63,58,55,63,55,51,63,53,48,63,51,44 DATA 63,49,41,63,47,37,63,45,34,63,43,31,63,41,27,63,39,24 DATA 60,37,23,58,36,22,56,34,21,54,33,20,52,32,20,50,31,19 DATA 47,29,17,44,27,16,41,26,14,38,24,13,35,22,12,32,21,10 DATA 29,19,09,26,17,08,23,15,07,20,13,06,17,12,05,14,10,03 DATA 11,08,03,09,06,02,06,04,01,63,63,63 PICTUREDATA: DATA 208,207,208,208,208,207,208,208,208,207,145,145,144 DATA 144,144,144,144,144,145,145,208,207,208,208,208,207 DATA 208,208,208,207,207,208,207,208,207,208,207,208,146 DATA 146,144,144,139,139,139,139,139,144,144,144,146,146 DATA 207,208,207,208,207,208,207,208,207,207,207,207,207 DATA 207,207,146,145,145,144,139,139,139,139,139,139,139 DATA 140,144,145,145,146,207,207,207,207,207,207,207,206 DATA 207,206,207,206,207,146,145,144,144,139,138,138,138 DATA 138,138,138,138,139,146,146,144,145,146,206,207,206 DATA 207,206,207,206,206,206,206,206,146,145,144,146,139 DATA 138,138,138,138,138,138,138,138,138,139,146,148,144 DATA 145,146,206,206,206,206,206,205,206,206,206,146,145 DATA 144,146,144,137,137,137,137,137,137,137,137,137,137 DATA 137,144,146,148,144,145,146,206,206,205,206,206,206 DATA 206,146,145,144,146,146,249,249,248,248,247,247,247 DATA 247,247,247,248,248,249,249,146,148,144,145,146,205 DATA 206,205,205,206,146,145,144,144,148,249,247,246,245 DATA 244,244,244,244,244,244,244,244,245,246,247,249,148 DATA 148,144,145,146,205,206,205,205,146,144,148,151,247 DATA 235,235,235,235,235,235,235,235,235,235,235,235,235 DATA 235,235,235,247,151,148,144,146,205,205,204,146,144 DATA 148,151,247,245,235,235,235,235,235,235,235,235,235 DATA 235,235,235,235,235,235,235,245,247,151,148,144,146 DATA 205,204,144,148,151,240,242,245,235,235,235,235,235 DATA 235,235,235,235,235,235,235,235,235,235,235,245,242 DATA 240,151,148,144,204,144,148,151,156,238,242,242,235 DATA 235,235,235,235,235,235,235,235,235,235,235,235,235 DATA 235,235,242,242,238,156,151,144,144,144,148,151,156 DATA 238,245,238,235,235,235,235,235,235,235,235,235,235 DATA 235,235,235,235,235,235,238,245,238,156,151,148,144 DATA 144,151,156,156,238,247,238,235,235,235,235,235,235 DATA 235,235,235,235,235,235,235,235,235,235,238,247,238 DATA 155,156,148,144,148,151,156,156,239,242,240,232,233 DATA 234,234,234,235,238,235,232,238,238,235,234,234,233 DATA 232,240,242,239,156,156,151,148,148,151,156,156,155 DATA 238,241,236,232,232,234,235,240,233,235,230,234,240 DATA 235,234,232,232,236,241,238,155,156,156,151,148,148 DATA 151,151,156,156,155,241,240,236,233,235,235,235,238 DATA 240,240,238,235,235,235,233,236,240,241,155,156,156 DATA 156,151,148,148,151,151,156,156,156,244,240,238,238 DATA 235,235,235,235,235,235,235,235,235,235,238,238,240 DATA 244,156,156,156,151,151,148,148,148,151,151,156,156 DATA 155,241,236,235,235,235,235,235,235,235,235,235,235 DATA 235,235,236,241,155,156,156,151,151,151,148,148,148 DATA 151,151,151,156,156,155,236,235,235,235,235,235,235 DATA 235,235,235,235,235,235,236,156,156,156,151,151,151 DATA 148,148,144,148,148,151,151,151,156,156,244,236,235 DATA 235,235,235,235,235,235,235,235,235,236,244,156,156 DATA 151,151,151,148,148,144,144,144,148,148,148,151,151 DATA 156,246,243,236,235,235,235,235,235,235,235,235,236 DATA 243,246,156,151,151,151,148,148,144,144,151,151,144 DATA 144,148,148,148,151,246,243,240,235,235,235,235,235 DATA 235,235,235,240,243,246,151,151,148,148,148,144,144 DATA 151,151,151,151,151,144,144,148,148,148,244,241,235 DATA 235,235,235,235,235,235,235,241,244,148,148,148,148 DATA 144,144,151,151,151,148,148,151,151,151,151,144,144 DATA 148,148,244,235,235,235,235,235,235,235,235,244,148 DATA 148,148,144,144,151,151,151,151,148,148,148,148,148 DATA 151,151,151,144,144,148,148,235,235,235,235,235,235 DATA 235,235,148,148,144,144,151,151,151,151,148,148,148 DATA 148,148,148,148,148,148,151,151,144,144,148,148,244 DATA 241,239,239,241,244,148,148,144,144,151,151,151,148 DATA 148,148,148,148,148,148,148,148,148,148,148,151,151 DATA 144,144,148,148,244,239,239,244,148,148,144,144,151 DATA 151,148,148,148,148,148,148,148,148,148,148,148,148 DATA 148,148,148,151,151,144,144,148,148,240,240,148,148 DATA 144,144,151,151,148,148,148,148,148,148,148,148,148 DATA 148,148,148,148,148,148,148,148,151,151,144,144,148 DATA 244,244,148,144,144,151,151,148,148,148,148,148,148 DATA 148,148,148 EYES01: DATA 246,243,241,239,239,237,237,237,237,237,237,239,239 DATA 241,244,246,245,247,247,247,247,247,240,238,238,240 DATA 247,247,247,247,247,245,242,240,239,242,242,244,247 DATA 235,234,247,244,242,242,239,240,242,240,244, 3,148 DATA 8,242,244,235,232,244,242, 8,148, 3,244,240,237 DATA 237,237,237,240,240,240,235,232,240,240,240,237,237 DATA 237,237,233,234,235,235,236,238,238,235,232,240,238 DATA 238,236,235,234,233 MOUTH01: DATA 238,235,232,232,232,232,235,238,238,243,240,240,240 DATA 240,243,238,238,235,232,232,232,232,235,238,235,236 DATA 236,238,238,236,236,235,236,235,235,232,232,235,235 DATA 236,243,238,235,235,235,235,238,243,241,241,243,243 DATA 243,243,241,241,244,241,241,240,240,241,241,244 EYES02: DATA 246,243,241,239,239,237,237,237,237,237,237,239,239 DATA 241,244,246,245,247,247,247,247,247,240,238,238,240 DATA 247,247,247,247,247,245,242,240,239,240,242,244,247 DATA 235,234,247,244,242,240,239,240,242,240,242,239,237 DATA 240,242,244,235,232,244,242,240,237,239,242,240,237 DATA 237,242,242,242,242,240,235,232,240,242,242,242,242 DATA 237,237,233,234,235,235,236,238,238,235,232,240,238 DATA 238,236,235,234,233 MOUTH02: DATA 238,235,232,232,232,232,235,238,238,243, 8, 3, 3 DATA 8,243,238,238,235,232,232,232,232,235,238,235,236 DATA 236,238,238,236,236,235,236,235,235,232,232,235,235 DATA 236,243,238,235,235,235,235,238,243,241,241,243,243 DATA 243,243,241,241,244,241,241,240,240,241,241,244 MOUTH03: DATA 238,235,232,232,232,232,235,238,238,243, 8, 3, 3 DATA 8,243,238,238,240,245,245,245,245,240,238,235,235 DATA 232,232,232,232,235,235,236,236,236,238,238,236,236 DATA 236,240,235,235,232,232,235,235,240,243,240,235,235 DATA 235,235,240,243,244,241,243,243,243,243,241,244 EYES04: DATA 246,243,241,239,239,237,237,237,237,237,237,239,239 DATA 241,244,246,245,247,247,244,239,237,242,238,238,242 DATA 237,239,244,247,247,245,242,240,242,247,247,247,247 DATA 235,234,247,247,247,247,242,240,242,240,244, 3,148 DATA 8,242,244,235,232,244,242, 8,148, 3,244,240,237 DATA 237,237,237,240,240,240,235,232,240,240,240,237,237 DATA 237,237,233,234,235,235,236,238,238,235,232,240,238 DATA 238,236,235,234,233 MOUTH04: DATA 238,235,232,232,232,232,235,238,240,243, 8, 3, 3 DATA 8,243,240,240,245,247,247,247,247,245,240,235,240 DATA 245, 49, 49,245,240,235,236,235,232,232,232,232,235 DATA 236,240,236,236,238,238,236,236,240,243,238,235,232 DATA 232,235,238,243,244,240,235,235,235,235,240,244