Name: Anonymous 2018-10-25 12:02
That is what I wrote so far:
https://jsfiddle.net/Nikita_Sadkov/4h72j5s6/
https://jsfiddle.net/Nikita_Sadkov/4h72j5s6/
w=120
h=100
buf={}
palete={15,15,
14,14,
9,9,
6,6,
3,
7,
1,
0}
function TIC()
--Init matrix
if t==0 then
for x=0,w do
buf[x]={}
for y=0,h do
buf[x][y]=0
end
end
end
--Reduce load on CPU
if(t%8/2==1) then
--Clear screen
cls(0)
--Text
print("Fire Walk with me",70,80)
--Move Fire And Smooth
for x=1,w-1 do
for y=1,h do
c=buf[x][y]
if c then
b=buf[x][y-1] or 0
t=buf[x][y+1] or 0
l=buf[x-1][y] or 10
r=buf[x+1][y] or 10
c=math.floor((b+t+l+r)/3.2)
end
buf[x][y-2]=c
end
end
--Add more fire at bottom
for x=0,w do
buf[x][h]=math.random(1,4)
buf[x][h-1]= buf[x][h]
end
--Draw Fire
for x=0,w do
for y=0,h do
c=palete[buf[x][y]]
if c then pix(60+x,138+y-h,c)end
end
end
end
t=t+1
end