Einzelnen Beitrag anzeigen

OmahaHawk

Registriert seit: 13. Mär 2009
20 Beiträge
 
#1

Hilfe bei einem kleinen Spiel

  Alt 10. Sep 2009, 16:28
hallo DP Community ,

ich will ein kleines Spiel programmieren. Es ist sehr simpel und es klappt auch alles gut, nur habe ich ein Problem :
ich will das der asteroid quer durch das bild fliegt; momentan fliegt er nur senkrecht hinunter

Delphi-Quellcode:
procedure TForm1.Timer1Timer(Sender: TObject);
begin
randomize;
If shape1.top > 360 then
begin
shape1.Top := 50;
shape1.left := random(640);
Score := Score - 1;
Label1.Caption := inttostr(Score);
end;
shape1.Top := shape1.Top + 5;
If (shape1.Top > 328) and (Shape1.Left > Shape2.left-32) and (Shape1.Left < Shape2.left+64) then
begin
Score := Score + 1;
Label1.Caption := inttostr(Score);
shape1.Top := 50;
shape1.left := random(640);
end;
end;

procedure TForm1.FormActivate(Sender: TObject);
begin
Score := 0;
end;

procedure TForm1.FormKeyPress(Sender: TObject; var Key: Char);
begin
If key = 'dthen Shape2.Left := Shape2.Left + 10;
If key = 'athen Shape2.Left := Shape2.Left - 10;
end;

end.
danke schonmal an alle die helfen
Danke für eure Hilfe !
  Mit Zitat antworten Zitat