bei diesem code hier und bei druck der "Nach-Unten-Taste" , wird sofort die unterste if-Methode aktiviert, obwohl doch erst die zweite, dann die dritte usw. dran wären. Woran liegt das????
Delphi-Quellcode:
procedure TFormZero.FormCreate(Sender: TObject);
begin
Aktiv := 1;
ImageNS.Picture.LoadFromFile ('Graphiken\newgame_a.bmp');
end;
Delphi-Quellcode:
procedure TFormZero.FormKeyDown(Sender: TObject; var Key: Word;
Shift: TShiftState);
begin
if key= vk_down then;
begin
Aktiv := Aktiv + 1;
if Aktiv = 1 then; //Neues Spiel
begin
ImageNS.Picture.LoadFromFile ('Graphiken\newgame_a.bmp');
ImageSL.Picture.LoadFromFile ('Graphiken\loadgame.bmp');
ImageO.Picture.LoadFromFile ('Graphiken\options.bmp');
ImageC.Picture.LoadFromFile ('Graphiken\credits.bmp');
ImageB.Picture.LoadFromFile ('Graphiken\beenden.bmp');
end;
if Aktiv = 2 then; //Spiel laden
begin
ImageNS.Picture.LoadFromFile ('Graphiken\newgame.bmp');
ImageSL.Picture.LoadFromFile ('Graphiken\loadgame_a.bmp');
ImageO.Picture.LoadFromFile ('Graphiken\options.bmp');
ImageC.Picture.LoadFromFile ('Graphiken\credits.bmp');
ImageB.Picture.LoadFromFile ('Graphiken\beenden.bmp');
end;
if Aktiv = 3 then; //Optionen
begin
ImageNS.Picture.LoadFromFile ('Graphiken\newgame.bmp');
ImageSL.Picture.LoadFromFile ('Graphiken\loadgame.bmp');
ImageO.Picture.LoadFromFile ('Graphiken\options_a.bmp');
ImageC.Picture.LoadFromFile ('Graphiken\credits.bmp');
ImageB.Picture.LoadFromFile ('Graphiken\beenden.bmp');
end;
if Aktiv = 4 then; //Credits
begin
ImageNS.Picture.LoadFromFile ('Graphiken\newgame.bmp');
ImageSL.Picture.LoadFromFile ('Graphiken\loadgame.bmp');
ImageO.Picture.LoadFromFile ('Graphiken\options.bmp');
ImageC.Picture.LoadFromFile ('Graphiken\credits_a.bmp');
ImageB.Picture.LoadFromFile ('Graphiken\beenden.bmp');
end;
if Aktiv = 5 then; //Beenden
begin
ImageNS.Picture.LoadFromFile ('Graphiken\newgame.bmp');
ImageSL.Picture.LoadFromFile ('Graphiken\loadgame.bmp');
ImageO.Picture.LoadFromFile ('Graphiken\options.bmp');
ImageC.Picture.LoadFromFile ('Graphiken\credits.bmp');
ImageB.Picture.LoadFromFile ('Graphiken\beenden_a.bmp');
end;
end;
end;