Thema: Delphi Wände im Spiel

Einzelnen Beitrag anzeigen

Meistermg

Registriert seit: 2. Apr 2010
Ort: Schwieberdingen
14 Beiträge
 
Delphi 2010 Architect
 
#5

Re: Wände im Spiel

  Alt 2. Apr 2010, 21:52
Es gibt ja auch noch nich wirklich einen.
Das is alles:
Code:
unit Main;

interface

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

type
  TForm1 = class(TForm)
    Panel1: TPanel;
    Shape1: TShape;
    procedure FormKeyDown(Sender: TObject; var Key: Word; Shift: TShiftState);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  Form1: TForm1;

implementation

{$R *.dfm}


procedure TForm1.FormKeyDown(Sender: TObject; var Key: Word;
  Shift: TShiftState);
begin
 case Key of
    VK_LEFT: begin
      shape1.Left := shape1.Left - 5;
      Key := 0;
    end;
    VK_RIGHT: begin
      shape1.Left := shape1.Left + 5;
      Key := 0;
    end;
    VK_UP: begin
      shape1.Top := shape1.Top - 5;
      Key := 0;
    end;
    VK_DOWN: begin
      shape1.Top := shape1.Top + 5;
      Key := 0;
    end;
  end;
end;

end.
  Mit Zitat antworten Zitat