【发布时间】:2010-02-12 08:59:14
【问题描述】:
大家好,我的碰撞检测代码如下 我需要它循环浏览主窗体上的 55 张图片 //外星人被命名为外星人1,外星人2等 //image2是collison对象(子弹)
代码是涡轮增压德尔福
procedure TForm1.TimeralienshotTimer(Sender: TObject)
var
ax2 : integer;
bx2 : integer;
ay2 : integer;
by2 : integer;
alienX : array[1..55] of integer;
alienY : array[1..55] of integer;
Index: Integer;
begin
for index := 1 to 55 do
alienX[index]:= alien([index]).left <--- the problem is this code here !!!!
ax2 := alienX + 21;
bx2 := Image2.left + 10;
ay2 := AlienY + 25;
by2 := Image2.top + 24;
if ax2 >= alienX then
if alienX <= bx2 then
if ay2 >= image2.top then
if alienY <= by2 then
begin
alien[index].Visible := false;
Image2.top := 875;
Image2.left := 648;
Timershotmovment.Enabled := false;
end;
end;
【问题讨论】:
-
代码是 TURBO DELPHI
-
你真的应该这样格式化你的代码。使用代码示例按钮。在此处查看有关格式化帖子的更多信息:stackoverflow.com/editing-help
-
差不多了,您只需要将代码的顶部也添加到代码块中,这将使荧光笔更容易正确语法高亮代码。正确添加delphi标签后,不需要在帖子中用大写字母写语言。
-
如果代码导致编译错误,您也应该发布。
-
除了您的代码无法编译之外,您的问题究竟是什么?