DECLARE SUB firetext (text$, tx!, ty!, spd!, ri!, gi!, bi!, lgth!)
'* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
'*                    F I R E T E X T                          *
'*                                                             *
'* Written specially for gameprog.com                          *
'* This file was downloaded from :                             *
'* G A M E     P R O G R A M M I N G     ' 9 9                 *
'* http://www.gameprog.com                                     *
'*                                                             *
'* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
'Please remember that this programme changes the palette. So this
'would best be used for introductions with black background. NEVER
'use this in the middle of the programme where there are other
'pictures or text on screen. If you don't follow this, your programme
'will still work but there's a very big possiblity that screen will
'start to have garbage all over it...

'D E S C R I P T I O N
'---------------------
'
'SUB firetext (text$, tx!, ty!, spd!, ri!, gi!, bi!, lgth!)
'text$    - The text you want to set fire to.
'tx!      - The column where you want the text to be. (1 to 40)
'ty!      - The row where you want the text to be. (3 to 23)
'spd!     - The burn speed. The smaller the number, the longer it'll
'           take for the text for burn completely. It does not affect
'           the flame speed. ( 1 to 50 )
'ri!      - Red intensity ( 1 to 10 )
'gi!      - Green intensity ( 1 to 10 )
'bi!      - Blue intensity ( 1 to 10 )
'lgth!    - the length of the fire. (The shorter, the faster)(10 to 20)


SCREEN 13
CLS
CALL firetext("F I R E T E X T", 12, 13, 5, 0, 10, 10, 20)
CLS
SCREEN 0
WIDTH 80
END

SUB firetext (text$, tx!, ty!, spd!, ri!, gi!, bi!, lgth!)
ri! = 11 - ri!
gi! = 11 - gi!
bi! = 11 - bi!
IF ri! <= 0 THEN ri! = 0
IF gi! <= 0 THEN gi! = 0
IF bi! <= 0 THEN bi! = 0
FOR j = 1 TO 63
r = INT(j / ri!)
g = INT(j / gi!)
b = INT(j / bi!)
colr = 65536 * b + 256 * g + r
PALETTE j, colr
NEXT j

COLOR 63
LOCATE ty!, tx!: PRINT text$
f! = INT(ty * 8 - 9)
e = INT(f! - lgth)
g1 = INT((tx - 1) * 8)
g2 = INT((tx + LEN(text$) - 1) * 8) - 1
spd! = INT(spd!)
spd! = spd! / 1000
REDIM lookup(g2 - g1 + 3) AS INTEGER
rc! = INT(21 - lgth!)
FOR x = g1 TO g2
RANDOMIZE TIMER
lookup(x - g1) = INT(RND * rc!) + 1
NEXT x
DO
DEF SEG = &HA000
FOR y = e TO f!
f! = f! + spd!
FOR x = g1 TO g2
col = (POINT((x + RND * 2 - 1), y) + POINT(x, y + 1)) / 2 - lookup(x - g1)
IF col < 1 THEN GOTO skip
POKE x + y * 320&, col
skip:
NEXT x
NEXT y
DEF SEG
IF INKEY$ <> "" THEN GOTO n
LOOP
n:
END SUB

Discuss this article in the forums


Date this article was posted to GameDev.net: 7/16/1999
(Note that this date does not necessarily correspond to the date the article was written)

See Also:
Fire

© 1999-2011 Gamedev.net. All rights reserved. Terms of Use Privacy Policy
Comments? Questions? Feedback? Click here!