Jumat, 01 November 2013
MEMBUAT PERGERAKAN OBYEK DENGAN DELPHI 7
unit uQuis;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, ExtCtrls, jpeg;
type
TfrmQuis = class(TForm)
imgPertama: TImage;
imgKedua: TImage;
imgKetiga: TImage;
tmrEnter: TTimer;
procedure FormKeyDown(Sender: TObject; var Key: Word;
Shift: TShiftState);
procedure tmrEnterTimer(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
frmQuis: TfrmQuis;
implementation
uses StrUtils;
var kiri :boolean;
{$R *.dfm}
procedure TfrmQuis.FormKeyDown(Sender: TObject; var Key: Word;
Shift: TShiftState);
begin
if key = VK_RETURN then
begin
kiri := True;
tmrEnter.Enabled := True;
end
end;
procedure TfrmQuis.tmrEnterTimer(Sender: TObject);
begin
if imgPertama.Top>=0 then
begin
imgPertama.Top := imgPertama.Top - 5;
imgPertama.Left := imgPertama.Left + 5;
end
else
begin
imgPertama.Left := imgPertama.Left - 5;
end;
if imgKedua.Top>=0 then
begin
imgKedua.Top := imgKedua.Top - 5;
end
else
begin
imgKedua.Left := imgKedua.Left+ 5;
end;
if imgKetiga.Left >=0 then
begin
imgKetiga.Top := imgKetiga.Top - 5;
imgKetiga.Left := imgKetiga.Left - 5;
end
else
begin
imgKetiga.Top := imgKetiga.Top + 5;
end;
end;
end.
Langganan:
Posting Komentar (Atom)
Tidak ada komentar:
Posting Komentar