Falling sand

Code:
for(each grain of sand)
{
   if(pixel below is empty)move down;
   else if(pixel below-right is empty and pixel below-left is empty)
   {
      generate random number;
      if(random number < .5) go down-left;
      else go down-right;
   }
   else if(pixel below-right is empty) go down-right;
   else if(pixel below-left is empty) go down-left;
   else do nothing;
}

:cool:

(its really not much different than the particle engine I wrote using DirectDraw)
 
hehe
i made a wall,i filled it with water, and then broke the wall so it would pour out on that ball thing.....
 
Back
Top