Sand and Water v3.1

See inside
Notes and Credits

★★★ SAND and WATER ★★★
Yep - One of those sand simulators :) - So why did I make this project? Well, because this idea came to me - why can't we interact with the sand... like push it around? So I gave it a go! Also, I tried to make the project run quick by using lists of active sand to only process the sand that is moving. I recently updated the project to add water too. Now water simulation is FAR harder and more laggy than sand so forgive the lag if you start trying to hurl lots of water around :)

★★★ Controls ★★★
 Mouse -  Move around to push sand.
 Click -  Drop New Sand
 Drag -  Click and drag a sand dropper to move or delete
 T -   Tool - (Spray, Pencil, Eraser, etc)
 M -   Material - (Sand, Water, Concrete, etc)
 S -   Size - (of brush / pen)
 H -   Hand - (for pushing sand)
 P -   Pause
 R -   Reset

As always - Have fun!

★★★ So how does it work? ★★★
I have 3 main lists in my scripts:
L - Level Grid (a row for every possible pixel location)
A - Active Sand (a list of the active sand locations on the grid)
X - Invalidate (a list of screen locations that need repainting)
P - Power (used by water to evaporate old water)

I only look for movement of active sand pixels, and when one moves, it looks for new sand pixels to add to the active sand pixel list.

The pushing of sand is done by tracing from the current mouse position across the sand piles looking for a possible empty space on the other side.

★★★ Change Log ★★★
16 Mar 2018 - v3.1 ★ New left hand toolbar ★ Sand and water interact better (slow fall and drift in water + fixed water teleporting)
6 Mar 2018 - v2.2 ★ Blue is now officially water! Took some doing! Hope it doesn't lag too much to be enjoyable!
5 Mar 2018 - v2.0 ★ Removed air bubbles in sand when moved ★ Prevent sand being deleted when moved ★ Added Toolbar ★ Added Blue sand - floats on orange sand ★ Added sand droppers

Shared: 1 Mar 2018 Modified: 16 Mar 2018
Favorite this project 5021
Love this project 6025
Total views 88631
View the remix tree  307
More projects by griffpatch