unit Unit3;

interface

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

type
  TForm3 = class(TForm)
    Image1: TImage;
    Image2: TImage;
    Timer1: TTimer;
    procedure FormCreate(Sender: TObject);
    procedure Timer1Timer(Sender: TObject);
    procedure FormKeyDown(Sender: TObject; var Key: Word;
      Shift: TShiftState);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  Form3: TForm3;
  y:integer;
  shagy:integer;
  fon2:tbitmap;
  ka:tbitmap;
implementation

{$R *.dfm}

procedure TForm3.FormCreate(Sender: TObject);
begin
shagy:=25;
fon2:=tbitmap.create;
ka:=tbitmap.create;
fon2.loadfromfile('fon2.bmp');
ka.loadfromfile('ka.bmp');
ka.Transparent:=true;
image1.Canvas.Draw(0,0,fon2);
image1.Canvas.Draw(190,y,ka);
end;

procedure TForm3.Timer1Timer(Sender: TObject);
begin
y:=y+shagy;
if y>500 then shagy:=shagy-1;
if y<0 then shagy:=shagy-1;
image1.Canvas.Draw(0,0,fon2);
image1.Canvas.Draw(190,y,ka);
end;

procedure TForm3.FormKeyDown(Sender: TObject; var Key: Word;
  Shift: TShiftState);
begin
if key=38 then shagy:=-15;
if key=40 then shagy:=15;
end;

end.
