Make your own free website on Tripod.com
with adagraph; use adagraph;
with Ada.Numerics.Elementary_Functions;
use Ada.Numerics.Elementary_Functions;

procedure pendulo is
  x,y,last_x,last_y,vx:integer;
begin
	
Open_Graph_Window(600,600);

draw_line(100,500,500,500,black); --Base

draw_line(100,501,500,501,black);
draw_line(100,502,500,502,black);

	
draw_circle(200,200,30,red,true);
last_x:=200;
x:=200;
last_y:=200;
y:=200;
vx:=1;

loop

  draw_line(last_x,last_y,300,500,white);   --apagando o rastro!

  draw_circle(last_x,last_y,30,white,false);
  draw_circle(last_x,last_y,31,white,false);

   x:=x+vx;

   y:=200+integer(13.0*sin(3.14/2.0*float(x)/100.0));

  draw_line(x,y,300,500,blue);	
  draw_circle(x,y,30,red,true);
  
  last_x:=x;
  last_y:=y;

   if x>= 400 or x<=200 then
      vx:=-vx;
   end if;

  for a in 1..50000 loop
   null;
  end loop;  

end loop;

end pendulo;


syntax highlighted by Code2HTML, v. 0.9