summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--xd.c19
1 files changed, 15 insertions, 4 deletions
diff --git a/xd.c b/xd.c
index e682773..ba8b4fe 100644
--- a/xd.c
+++ b/xd.c
@@ -4278,23 +4278,34 @@ static void SnowDemo(void)
for(f = 0; f < SNOW_FLAKES; f++)
{
+ int dir;
+
+ if (RND(10) > 5)
+ {
+ dir = 1;
+ }
+ else
+ {
+ dir = -1;
+ }
+
if (map[XY(snow[f].x, snow[f].y + 1)] == 0)
{
Plot(snow[f].x, snow[f].y, black);
snow[f].y++;
Plot(snow[f].x, snow[f].y, white);
}
- else if (map[XY(snow[f].x + 1, snow[f].y + 1)] == 0)
+ else if (map[XY(snow[f].x + dir, snow[f].y + 1)] == 0)
{
Plot(snow[f].x, snow[f].y, black);
- snow[f].x++;
+ snow[f].x += dir;
snow[f].y++;
Plot(snow[f].x, snow[f].y, white);
}
- else if (map[XY(snow[f].x - 1, snow[f].y + 1)] == 0)
+ else if (map[XY(snow[f].x - dir, snow[f].y + 1)] == 0)
{
Plot(snow[f].x, snow[f].y, black);
- snow[f].x--;
+ snow[f].x -= dir;
snow[f].y++;
Plot(snow[f].x, snow[f].y, white);
}