ADİL YILDIZ HAYATIN BİR KÖŞESİNDEN TUTUNAN HERKES İÇİN HERŞEY

3Apr/080

Görsel Programlama Proje

Posted by Adil YILDIZ

Proje dosyasını aşağıdaki adresten indirebilirsiniz.

Hedef Vurma

?View Code PASCAL
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
unit Unit1;
 
interface
 
uses
  Windows, Messages, SysUtils, Variants,
  Classes, Graphics, Controls, Forms,
  Dialogs, ExtCtrls, ComCtrls, StdCtrls;
 
type
  TForm1 = class(TForm)
    TrackBar1: TTrackBar;
    TrackBar2: TTrackBar;
    Panel1: TPanel;
    Button1: TButton;
    Timer1: TTimer;
    Panel2: TPanel;
    Button2: TButton;
    Label1: TLabel;
    procedure Timer1Timer(Sender: TObject);
    procedure FormCreate(Sender: TObject);
    procedure Button1Click(Sender: TObject);
    procedure Button2Click(Sender: TObject);
    procedure hedefbelirle();
  private
    { Private declarations }
  public
    { Public declarations }
  end;
 
var
  Form1: TForm1;
  puan: integer;
 
implementation
 
uses Math;
 
{$R *.dfm}
 
procedure TForm1.Timer1Timer(Sender: TObject);
begin
hedefbelirle();
end;
 
procedure TForm1.hedefbelirle();
begin
panel1.Left:=Random(360)+40;
panel1.Top:=Random(360)+40;
end;
 
procedure TForm1.FormCreate(Sender: TObject);
begin
randomize;
end;
 
procedure TForm1.Button1Click(Sender: TObject);
begin
hedefbelirle();
Timer1.Enabled:=true;
puan:=0;
Label1.Caption:='0';
end;
 
procedure TForm1.Button2Click(Sender: TObject);
begin
if((TrackBar1.Position>Panel1.Left) and
(TrackBar1.Position<Panel1.Left+Panel1.Width) and
(TrackBar2.Position>Panel1.Top) and
(TrackBar2.Position<Panel1.Top+Panel1.Height))then
begin
ShowMessage('Vurdun');
puan:=puan+10;
label1.Caption:=inttostr(puan);
end
else
begin
ShowMessage('Vuramadın');
puan:=puan-5;
label1.Caption:=inttostr(puan);
end;
 
hedefbelirle();
end;
 
end.