Huhu,
I wanted to make an objectthat emit's heat and therefore melts away ice and snow. It emits little heat objects (the little black squares) that execute the function Melt() that I've written:
It checks every pixel marked with "1" in the matrix (every line from left to right, starting with the bottom one) and when it's ice (or snow), it removes that pixel and inserts a loose pixel of water.
The problem is, that when it removes ice it doesn't make static water pixels instable. In some cases newly created water pixels flow away where they have space, and leave a hole in the static water. (like in the bottom left corner of the picture.)
Disabling
I wanted to make an objectthat emit's heat and therefore melts away ice and snow. It emits little heat objects (the little black squares) that execute the function Melt() that I've written:
func Melt()
{
//a square matrix making up a circle where the material checks are executed. (only works with uneven numbers??)
var matrix = [[0,0,1,1,1,1,1,0,0],
[0,1,1,1,1,1,1,1,0],
[1,1,1,1,1,1,1,1,1],
[1,1,1,1,1,1,1,1,1],
[1,1,1,1,1,1,1,1,1],
[1,1,1,1,1,1,1,1,1],
[1,1,1,1,1,1,1,1,1],
[0,1,1,1,1,1,1,1,0],
[0,0,1,1,1,1,1,0,0]];
var length = GetLength(matrix);
var half = (length-1)/2;
var startX = GetX()-half;
var startY = GetY()+half;
for(var i; i<length; i++)
{
var line = matrix[i']; //Ignore the ', it is because of the forum formatting...
for(var j; j<length; j++)
{
if(line[j])
{
if(GetMaterial(-half+j, half-i) == Material("Ice") || GetMaterial(-half+j, half-i) == Material("Snow"))
{
DigFreeRect(startX+j, startY-i, 1, 1, 1, 1);
CastPXS("Water", 1, 1, -half+j, half-i);
}
}
}
j=0;
}
RemoveObject();
return;
}
It checks every pixel marked with "1" in the matrix (every line from left to right, starting with the bottom one) and when it's ice (or snow), it removes that pixel and inserts a loose pixel of water.
The problem is, that when it removes ice it doesn't make static water pixels instable. In some cases newly created water pixels flow away where they have space, and leave a hole in the static water. (like in the bottom left corner of the picture.)
Disabling
no_instability_check
makes the water instable, but also ice pixels, wich I don't want, because you have constantly ice pixels rain down then. Setting a solid mask and removing it the same frame works almost, but sometimes (but apperantly far less often than with no_instability_check
) that creates loose ice pixels, too. Are there any other ways you could make the water instable, but let the ice as it is?
Powered by mwForum 2.29.7 © 1999-2015 Markus Wichitill