Thema: Delphi Kollision/Abschuss

Einzelnen Beitrag anzeigen

Koki

Registriert seit: 11. Jan 2006
16 Beiträge
 
Delphi 2005 Personal
 
#5

Re: Kollision/Abschuss

  Alt 13. Mär 2006, 13:05
jo also hier ist mein bisheriger quellcode

Delphi-Quellcode:
unit Unit1;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, StdCtrls, ExtCtrls, Menus, Buttons;

type
  TForm1 = class(TForm)
    Image1: TImage;
    Image2: TImage;
    Image3: TImage;
    MainMenu1: TMainMenu;
    Datei1: TMenuItem;
    Start1: TMenuItem;
    Beenden1: TMenuItem;
    Timer1: TTimer;
    Timer2: TTimer;
    Image4: TImage;
    Image5: TImage;
    procedure FormKeyDown(Sender: TObject; var Key: Word; Shift: TShiftState);
    procedure Beenden1Click(Sender: TObject);
    procedure Start1Click(Sender: TObject);
    procedure Timer1Timer(Sender: TObject);
    procedure Timer2Timer(Sender: TObject);

  private
    { Private-Deklarationen }
  public
    { Public-Deklarationen }
  end;

var
  Form1: TForm1;
  a,b,i,x,y:integer;

implementation

{$R *.dfm}


procedure TForm1.Start1Click(Sender: TObject);
 begin
  form1.doublebuffered:=true;
  x:=0; y:=0;
  image1.picture.loadfromfile('space4.bmp');
  image2.picture.loadfromfile('player1.bmp');
  image3.picture.loadfromfile('ufo5.bmp');
  image5.picture.loadfromfile('red02.bmp');
  image2.Left:=x;
  image2.Top:=y;
  image4.Left:=a;
  image4.Top:=b;
  timer1.Enabled:=true;
  timer2.Enabled:=true;
 end;


procedure Feuern(c,d:integer);
 begin
  form1.image4.picture.loadfromfile('bullet1.bmp');
  c:=0;
  if c<>0 then
   begin

   end;
 end;

procedure Tform1.FormKeyDown(Sender: TObject; var Key: Word;
  Shift: TShiftState);
 var h: integer;
 begin
  form1.Caption:=inttostr(key);
  if key=37 then begin x:=x-5; a:=a-5; end;
  if key=38 then begin y:=y-5; b:=b-5; end;
  if key=39 then begin x:=x+5; a:=a+5; end;
  if key=40 then begin y:=y+5; b:=b+5; end;
{  if key=17 then begin Feuern(c,d);    end;  }
 end;

procedure Tform1.Timer1Timer(Sender: TObject);
 begin
  image2.Left:=x;
  image2.Top:=y;
 end;

procedure TForm1.Timer2Timer(Sender: TObject);
 begin
  image4.Left:=a;
  image4.Top:=b;
 end;

procedure TForm1.Beenden1Click(Sender: TObject);
 begin
  close;
 end;

end.
  Mit Zitat antworten Zitat