unit Unit1 interface uses Windows Messages SysUtils Variants Classes G

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, ExtCtrls, Buf_FSFon, jpeg;
type
TForm1 = class(TForm)
Image1: TImage;
Image3: TImage;
procedure FormKeyDown(Sender: TObject; var Key: Word;
Shift: TShiftState);
procedure FormCreate(Sender: TObject);
procedure FormPaint(Sender: TObject);
procedure Image3Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
Car, fon: TBitmap;
GameStart: boolean;
implementation
uses Unit3;
{$R *.dfm}
procedure TForm1.FormKeyDown(Sender: TObject; var Key: Word;
Shift: TShiftState);
begin
if key=VK_UP then begin
{
inc(a,7);
Canvas.Draw(300,100-a,car);
}
DoubleBuffered := true;
Image1.Picture.LoadFromFile('car.bmp');
Image1.Transparent:=true;
Image1.Top:=Image1.Top -7;
end;
if key=VK_LEFT then begin
{
inc(b,7);
Canvas.Draw(300-b,100,car);
}
DoubleBuffered := true;
Image1.Picture.LoadFromFile('car_left.bmp');
Image1.Transparent:=true;
Image1.Left:=Image1.Left -7;
end;
if key=VK_DOWN then begin
{
inc(c,7);
Canvas.Draw(300,100+c,car);
}
DoubleBuffered := true;
Image1.Picture.LoadFromFile('car.bmp');
Image1.Transparent:=true;
Image1.Top:=Image1.Top +7;
end;
if key=VK_RIGHT then begin
{
inc(d,7);
Canvas.Draw(300+d,100,car);
}
DoubleBuffered := true;
Image1.Picture.LoadFromFile('car_right.bmp');
Image1.Transparent:=true;
Image1.Left:=Image1.Left +7;
end;
end;
procedure TForm1.FormCreate(Sender: TObject);
begin
fon:=TBitmap.Create;
fon.LoadFromFile('fon.bmp');
Car:=TBitmap.Create;
Car.LoadFromFile('car.bmp');
Canvas.Draw(0,0,fon);
Image1.Picture.Bitmap:=Car;
IMage1.Transparent:=true;
IMage3.Transparent:=true;
end;
procedure TForm1.FormPaint(Sender: TObject);
begin
Canvas.Draw(0,0,fon);
end;
procedure TForm1.Image3Click(Sender: TObject);
begin
GameStart:=True;
Image1.Visible:=true;
Image3.Visible:=false;
end;
end.