New Version 2 out. Click hereI made a very simple fluid simulation in Game Maker:
Link to videoHere's the source:
http://anova.57o9.org/junk/fluid.gm81The controls are: click to place a wall block, right click to release water, Shift to erase whatever is currently under the mouse, Delete to erase everything, and Enter to make a water pump that continually releases water.
The cellular automata rules are very simple:
1. If space to left empty: move left
2. If space to right empty: move right
3. If both left and right spaces are empty: randomly move either left or right
4. If space below empty: move down
Here's the code I used to simulate the water physics:
if position_empty(x,y+6)
{
y = y + 6;
exit
}
if position_empty(x+6,y) and position_empty(x-6,y)
{
randrange = irandom_range(1,2);
if randrange = 1 {x += 6};
if randrange = 2 {x -= 6};
exit
}
if position_empty(x+6,y)
{
x += 6
exit
}
if position_empty(x-6,y)
{
x -= 6
exit
}
I know I need to add a toolbar or a little box that shows the commands you can use in the next release. Besides this, any other suggestions or comments?