Log In  

\/v latest release

Cart #sandenginev4-0 | 2023-12-17 | Code ▽ | Embed ▽ | License: CC4-BY-NC-SA
3

left and right to cycle colors, up and down to change brush size

elements:
1 - smoke, floats upward and disipates
5 - gunpowder, a powder that explodes upon contact with fire
8 - fire, burns and emits smoke
9 - fuse, when lit, fire travels along it
10 - sand, an inert powdery substance
12 - water, a liquid
14 - acid, a liquid that erodes other substances, turning it into more of itself

i've implimented a new method of updating pixels, this has some upsides and downsides. One main thing right now is that liquids (water and acid) arent working quite how they should

feel free to make your own elements too! i've tried to make it pretty modular.
to add a new rule to a particle simply make a new item in sands like this:

sands[color]=function(x,y,c)
  -- your code here
end

for example. lets' make a pebble. All this pebble does is fall straight down. for the pebble, we'll go with color 5 (gray).
each cell is a pixel on the screen, so in order to check if there's anything below it, you pget the pixel y+1 of it:

if pget(x,y+1) then
  -- move cell
end

how do you move a cell? simple, you fake it! You just clear the old cell's position, and place a new cell where the new cell posiiton is!

if pget(x,y+1) then
  pset(x,y,0) -- clear old position
  pset(x,y+1,c) -- place in new position
end
P#138769 2023-12-16 14:41 ( Edited 2023-12-17 14:13)


[Please log in to post a comment]