主题:提问:我想用pascal 作雷电。。
谁能给点意见,怎么做碰撞检测?
部分程序如下:
procedure buildmain;
begin
setlinestyle(0,0,2);setcolor(green);
line(150,0,150,479);line(450,0,450,479);
setcolor(red);rectangle(5,5,105,55);
setcolor(4);rectangle(455,5,555,55);
setfillstyle(1,white);
circle(300,429,9);
rectangle(151,439,449,479);
floodfill(152,440,red);
setcolor(black);
outtextxy(152,450,'Use the "END" key to exit.');
outtextxy(152,462,'Use the direction key to move.');
end;
procedure lightgraph;
begin
for use[2]:=0 to 15 do
begin
setbkcolor(use[2]);
delay(15);
end;
setbkcolor(black);
end;
procedure planemove(x,y:integer);
begin
setcolor(black);circle(pointx,pointy,9);
if ((pointx<439)and(x>0)) then pointx:=pointx+x;
if ((pointx>161)and(x<0)) then pointx:=pointx+x;
if ((pointy<429)and(y>0)) then pointy:=pointy+y;
if ((pointy>11)and(y<0)) then pointy:=pointy+y;
setcolor(red);circle(pointx,pointy,9);
end;
procedure thunder;
begin
if enter2<>'thunder'then exit;
gd:=detect;
initgraph(gd,gm,' ');
pointx:=300;pointy:=429;
setcolor(3);
SetLineStyle(3,2,1);
circle(320,240,236);
line(0,0,639,479);
line(639,0,0,479);
setcolor(8);delay(1000);lightgraph;soundmax(512,1024);
outtextxy(250,88,'Thunderbolt flight');
outtextxy(250,108,'This is a Demo');
outtextxy(250,128,'Created by Lrc007');
outtextxy(100,208,'The idea is form duxi');
outtextxy(100,228,'Thanks for his idea');
outtextxy(100,248,'Same to all members');
outtextxy(385,208,'Provide by internet');
outtextxy(385,228,'By Turbo Pascal 7.0');
outtextxy(385,248,'Copyright(c)1991-2006');
outtextxy(250,368,'TMD system 8.501 plus');
outtextxy(230,388,'Waiting for the now system');
delay(1000);
cleardevice;lightgraph;soundmax(786,1429);setcolor(white);
outtextxy(230,220,'TMD SYSTEM 8.501 PLUS');
delay(1000);cleardevice;
outtextxy(230,220,'WE WILL DO IT BETTER');
delay(1000);
soundmax(429,1340);soundmax(712,589);soundmax(100,1100);
cleardevice;
buildmain;{初始化图像}
repeat{输入}
Case Upcase(Readkey) Of
#0:
case readkey of
#71:begin
setcolor(black);
circle(pointx,pointy,9);
pointx:=300;
pointy:=429;
setcolor(red);
circle(pointx,pointy,9);
end;
#79:begin cleardevice;closegraph;use[1]:=0;exit;end;
#72:planemove(0,-5);{移动飞机(一个圆圈)}
#80:planemove(0,5);
#75:planemove(-5,0);
#77:planemove(5,0);
end;
end;
部分程序如下:
procedure buildmain;
begin
setlinestyle(0,0,2);setcolor(green);
line(150,0,150,479);line(450,0,450,479);
setcolor(red);rectangle(5,5,105,55);
setcolor(4);rectangle(455,5,555,55);
setfillstyle(1,white);
circle(300,429,9);
rectangle(151,439,449,479);
floodfill(152,440,red);
setcolor(black);
outtextxy(152,450,'Use the "END" key to exit.');
outtextxy(152,462,'Use the direction key to move.');
end;
procedure lightgraph;
begin
for use[2]:=0 to 15 do
begin
setbkcolor(use[2]);
delay(15);
end;
setbkcolor(black);
end;
procedure planemove(x,y:integer);
begin
setcolor(black);circle(pointx,pointy,9);
if ((pointx<439)and(x>0)) then pointx:=pointx+x;
if ((pointx>161)and(x<0)) then pointx:=pointx+x;
if ((pointy<429)and(y>0)) then pointy:=pointy+y;
if ((pointy>11)and(y<0)) then pointy:=pointy+y;
setcolor(red);circle(pointx,pointy,9);
end;
procedure thunder;
begin
if enter2<>'thunder'then exit;
gd:=detect;
initgraph(gd,gm,' ');
pointx:=300;pointy:=429;
setcolor(3);
SetLineStyle(3,2,1);
circle(320,240,236);
line(0,0,639,479);
line(639,0,0,479);
setcolor(8);delay(1000);lightgraph;soundmax(512,1024);
outtextxy(250,88,'Thunderbolt flight');
outtextxy(250,108,'This is a Demo');
outtextxy(250,128,'Created by Lrc007');
outtextxy(100,208,'The idea is form duxi');
outtextxy(100,228,'Thanks for his idea');
outtextxy(100,248,'Same to all members');
outtextxy(385,208,'Provide by internet');
outtextxy(385,228,'By Turbo Pascal 7.0');
outtextxy(385,248,'Copyright(c)1991-2006');
outtextxy(250,368,'TMD system 8.501 plus');
outtextxy(230,388,'Waiting for the now system');
delay(1000);
cleardevice;lightgraph;soundmax(786,1429);setcolor(white);
outtextxy(230,220,'TMD SYSTEM 8.501 PLUS');
delay(1000);cleardevice;
outtextxy(230,220,'WE WILL DO IT BETTER');
delay(1000);
soundmax(429,1340);soundmax(712,589);soundmax(100,1100);
cleardevice;
buildmain;{初始化图像}
repeat{输入}
Case Upcase(Readkey) Of
#0:
case readkey of
#71:begin
setcolor(black);
circle(pointx,pointy,9);
pointx:=300;
pointy:=429;
setcolor(red);
circle(pointx,pointy,9);
end;
#79:begin cleardevice;closegraph;use[1]:=0;exit;end;
#72:planemove(0,-5);{移动飞机(一个圆圈)}
#80:planemove(0,5);
#75:planemove(-5,0);
#77:planemove(5,0);
end;
end;