Skip to content

Instantly share code, notes, and snippets.

@svnt
Last active May 9, 2018 00:17
Show Gist options
  • Save svnt/29d4a2dff0c0dd1e59b0eb41ab4befa1 to your computer and use it in GitHub Desktop.
Save svnt/29d4a2dff0c0dd1e59b0eb41ab4befa1 to your computer and use it in GitHub Desktop.
m=32
f={}
h=25
s=1 --sub from ++++- field color
for i=1,130*h do
--f[i]=m
f[i]=0
end
--p={7,8,7,8,7,8,7,8,7,8,7,8,7,8,7,8,7,8,7,8,7,8,7,8,7,8}
p={
0,1,2,5,6,
7,10,9,8,
9,10,7,
10,9,8,
13,11,15
}
p={
0,1,2,
8,9,8,9,10,
7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7
}
function _init()
end
function _update()
for y=2,h-2 do
for x=2,126 do
f[(y-1)*130+x] =
max(
((
f[y*130+x-1]+
f[y*130+x]+
f[y*130+x+1]+
f[(y+1)*130+x]
)/4)-s,0)
--if f[(y*130+1)+x] == nil then print "*" end
end
end
--
for y=h-3,h do
for x=1,128 do
--f[y*130+x]=rnd(m)
f[y*130+x]=rnd(m)
--f[y*130+x]=m
end
end
end
function _draw()
cls()
for y=0,h-7 do
for x=1,128 do
--col=f[y*130+x]
ofs=flr((f[y*130+x]*#p)/m+1)
pset(x,y+(128-h),p[ofs])
--pset(x,y*2+(128-h)-h,p[ofs])
--pset(x,y*2+(128-h)-1-h,p[ofs])
end
end
print(stat(1),10,10,1)
end
fire is damn easy to burn:
- loop the screen in x and y from top/left to bottom/right.
- for each pixel do:
get color/offset/... of pixels add them and divide by four and put the result one line above..
like...
5
123
4 ...2 is your current x/y position... so calculate (1+2+3+4)/4 and put the result to 5.
at the end put random colors all along the last line to keep it burning.
FIRE! ;)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment