home *** CD-ROM | disk | FTP | other *** search
/ DP Tool Club 18 / CD_ASCQ_18_111294_W.iso / dos / prg / pas / gfxfx / cannon.pas < prev    next >
Pascal/Delphi Source File  |  1994-05-28  |  557b  |  23 lines

  1.  
  2. program cannonball;
  3. uses crt;
  4. const vidseg:word=$a000; g=-9.81; x0=0; y0=100; v0=50; phi=50; dt=0.01;
  5. var t:real; xt,yt,v:integer;
  6.  
  7. function rad(alpha:integer):real; begin
  8.   rad:=(alpha/180)*pi; end;
  9.  
  10. begin
  11.   asm mov ax,13h; int 10h; end;
  12.   t:=0; v:=v0; yt:=1;
  13.   while (not keypressed) and (yt>=0) do begin
  14.     xt:=x0+round(v0*cos(rad(phi))*t);
  15.     yt:=y0+round(v*sin(rad(phi))*t+0.5*g*t*t);
  16.     mem[vidseg:(199-yt)*320+xt]:=15;
  17.     t:=t+dt;
  18.   end;
  19.   while keypressed do readkey;
  20.   while not keypressed do;
  21.   textmode(lastmode);
  22. end.
  23.