Advertisement
smay

Untitled

Feb 2nd, 2016
69
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Pascal 1.00 KB | None | 0 0
  1. uses
  2.   GraphABC;
  3.  
  4. const
  5.   count = 100;
  6.   Radius = 3;
  7.   disp = 2;
  8.  
  9. type
  10.   tPoint = record
  11.     x, y, v : Integer;
  12.   end;
  13.  
  14. var
  15.   s : array [1..count] of tPoint;
  16.   w, h: integer;
  17.  
  18. begin
  19.   window.SetSize(1000, 600);
  20.   randomize;
  21.   w := 5;
  22.   h := 5;
  23.   for var i := 1 to count do
  24.     begin
  25.       s[i].x := Random(Window.Width);
  26.       s[i].y := Random(Window.Height);
  27.       s[i].v := Random(1, 3);
  28.     end;
  29.    
  30.       Brush.Color := clWhite;
  31.   while true do
  32.     begin
  33.       LockDrawing;
  34.       clearwindow(clSkyBlue);
  35.      
  36.       for var i := 1 to count do
  37.         begin
  38.           FillCircle(s[i].x, s[i].y, Radius);
  39.  
  40.           s[i].y += s[i].v; //снежинки вниз
  41.           if s[i].y > Window.Height then
  42.             begin
  43.               s[i].x := Random(Window.Width);
  44.               s[i].y := 0;
  45.               s[i].v := Random(1, 3);
  46.             end
  47.           else
  48.             s[i].x += Random(-disp, +disp);
  49.         end;
  50.       Redraw;  
  51.       sleep(10);
  52.     end;
  53. end.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement