'=========================================================================== ' Subject: PARTICLE FLAME Date: 06-01-97 (16:18) ' Author: Daniel Davies Code: QB, QBasic, PDS ' Origin: ia53@rapid.co.uk Packet: GRAPHICS.ABC '=========================================================================== 'PARTICLE FLAME 'BY HANG-FIRE 'e-mail ia53@rapid.co.uk 'web site www.users.rapid.net.uk/ia53 'this flame uses moving particles and then smoothes them out to generate the 'flame, although it is much slower than the standard method for generating 'a flame, it looks quite good. SCREEN 13 RANDOMIZE TIMER TYPE particle x AS INTEGER y AS INTEGER c AS INTEGER END TYPE np% = 1000 DIM particle(np%) AS particle DIM image(50, 70) AS STRING * 1 FOR x% = 1 TO np% particle(x%).x = (RND * 40) - 20 particle(x%).y = (RND * 63) particle(x%).c = particle(x%).y NEXT x% OUT &H3C8, 0 FOR x% = 0 TO 63 READ r%, G%, B% OUT &H3C9, r% OUT &H3C9, G% OUT &H3C9, B% NEXT x% DEF SEG = &HA000 DO FOR x% = 1 TO np% image(particle(x%).x + 25, particle(x%).y) = CHR$(64 - particle(x%).c) IF particle(x%).y > 63 THEN particle(x%).x = (RND * 40) - 20 particle(x%).y = 1 particle(x%).c = 0 ELSE IF particle(x%).x = 0 THEN particle(x%).x = particle(x%).x + ((RND * 6) - 3) ELSEIF particle(x%).x < 0 THEN particle(x%).x = particle(x%).x + ((RND * 3) - 1) ELSE particle(x%).x = particle(x%).x + ((RND * 3) - 2) END IF particle(x%).y = particle(x%).y + 1 particle(x%).c = particle(x%).y END IF NEXT x% xm& = 63820 FOR y% = 1 TO 63 FOR x% = 1 TO 49 t% = ASC(image(x% - 1, y% - 1)) + ASC(image(x%, y% - 1)) + ASC(image(x% + 1, y% - 1)) t% = t% + ASC(image(x% - 1, y%)) + ASC(image(x%, y%)) + ASC(image(x% + 1, y%)) t% = (t% \ 6) - 1 IF t% < 0 THEN image(x%, y%) = CHR$(0) ELSE image(x%, y%) = CHR$(t%) END IF POKE x% + xm&, ASC(image(x%, y%)) NEXT x% xm& = xm& - 320 NEXT y% LOOP WHILE INKEY$ = "" DATA 0,0,0 DATA 0,0,8 DATA 2,0,10 DATA 10,0,7 DATA 18,0,5 DATA 26,0,2 DATA 32,0,0 DATA 36,0,0 DATA 39,0,0 DATA 42,0,0 DATA 46,1,0 DATA 50,3,0 DATA 54,5,0 DATA 58,7,0 DATA 63,9,0 DATA 63,11,0 DATA 63,13,0 DATA 63,15,0 DATA 63,17,0 DATA 63,19,0 DATA 63,21,0 DATA 63,23,0 DATA 63,25,0 DATA 63,27,0 DATA 63,29,0 DATA 63,31,0 DATA 63,33,0 DATA 63,35,0 DATA 63,38,0 DATA 63,40,0 DATA 63,42,0 DATA 63,44,0 DATA 63,46,0 DATA 63,48,0 DATA 63,50,0 DATA 63,52,0 DATA 63,53,0 DATA 63,54,0 DATA 63,54,0 DATA 63,55,0 DATA 63,56,0 DATA 63,57,0 DATA 63,58,0 DATA 63,59,0 DATA 63,60,0 DATA 63,61,0 DATA 63,62,0 DATA 63,63,1 DATA 63,63,5 DATA 63,63,9 DATA 63,63,12 DATA 63,63,16 DATA 63,63,20 DATA 63,63,23 DATA 63,63,27 DATA 63,63,31 DATA 63,63,34 DATA 63,63,38 DATA 63,63,42 DATA 63,63,45 DATA 63,63,49 DATA 63,63,52 DATA 63,63,56 DATA 63,63,60