1. Enclosure file: FLAMES.EX
-- flames.ex : variation on Jacques' fireprint
-- j.babor at gns.cri.nz
-- 96-12-19
include graphics.e
integer junk
sequence pal
procedure fireprint(integer row, integer col, sequence s)
integer c,len,x,x0,ymin,ymax
sequence y,Y
-- init
len=8*length(s)
x0 = 8*(col-1)
ymax=8*row -- base (just under the text)
ymin=ymax-16 -- top end of flames
y=repeat(ymin,len) -- current y
Y=y+6 -- current maxy (a couple of pixels above
-- the text - delayed burn)
text_color(63)
position(row,col)
printf(1,"%s",{s})
while get_key() = -1 do
for i = 1 to len do
x=x0+i-1
c = get_pixel({x,y[i]})-rand(25)
if c<0 then c=0 end if
pixel(c,{x,y[i]-1})
y[i]=y[i]+1
if y[i]>Y[i] then
y[i]=ymin
if Y[i]<ymax and rand(20)=1 then
Y[i]=Y[i]+1
end if
end if
end for
end while
end procedure
junk = graphics_mode(19)
-- set palette
for t = 0 to 63 do
pal = palette(t,{t,t,0})
end for
fireprint(12,15,"Happy Xmas")
junk = graphics_mode(-1)