...
var
Form1: TForm1;
a,b,c,d,e:integer;
skor:Real;
...
procedure TForm1.FormCreate(Sender: TObject);
begin
Form1.caption := 'Click The Button';
skor := 0;
Label1.caption := '';
Label2.caption := '';
Label3.caption := '';
Label4.caption := '';
Label5.caption := '';
Button1.visible := False;
Button2.visible := False;
Button3.visible := False;
Button4.visible := False;
Button5.visible := False;
Shape1.visible := False;
Shape2.visible := False;
Shape3.visible := False;
Shape4.visible := False;
Shape5.visible := False;
End;
procedure TForm1.Button1Click(Sender: TObject);
begin
if shape1.Brush.Color =clFuchsia then
begin
label1.caption :=
'Benar';
skor := skor +2.00;
end
else
begin
label1.Caption :=
'Salah';
skor := skor +0.50;
end;
timer1.Enabled :=False;
end;
procedure TForm1.Button2Click(Sender: TObject);
begin
if shape2.Brush.Color =clAqua then
begin
label2.caption :=
'Benar';
skor := skor +2.00;
end
else
begin
label2.Caption :=
'Salah';
skor := skor +0.50;
end;
timer2.Enabled :=False;
end;
procedure TForm1.Button3Click(Sender: TObject);
begin
if shape3.Brush.Color =clYellow then
begin
label3.caption :=
'Benar';
skor := skor +2.00;
end
else
begin
label3.Caption :=
'Salah';
skor := skor +0.50;
end;
timer3.Enabled :=False;
end;
procedure TForm1.Button4Click(Sender: TObject);
begin
if shape4.Brush.Color =clNavy then
begin
label4.caption :=
'Benar';
skor := skor +2.00;
end
else
begin
label4.Caption :=
'Salah';
skor := skor +0.50;
end;
timer4.Enabled :=False;
end;
procedure TForm1.Button5Click(Sender: TObject);
begin
if shape5.Brush.Color =clTeal then
begin
label5.caption :=
'Benar';
skor := skor +2.00;
end
else
begin
label5.Caption :=
'Salah';
skor := skor +0.50;
end;
timer5.Enabled :=False;
end;
procedure TForm1.Button6Click(Sender: TObject);
begin
Button1.Visible := True;
Button2.Visible := True;
Button3.Visible := True;
Button4.Visible := True;
Button5.Visible := True;
Button6.Visible := False;
Button7.Visible := False;
Shape1.Visible := True;
Shape2.Visible := True;
Shape3.Visible := True;
Shape4.Visible := True;
Shape5.Visible := True;
end;
procedure TForm1.Button7Click(Sender: TObject);
begin
showmessage('Ini Tombol Help');
end;
procedure TForm1.Button8Click(Sender: TObject);
begin
showmessage('Hai Rosiyana Dwi Anggarani, Skor Anda :
'+floattostr(skor));
application.Terminate;
end;
procedure TForm1.Timer1Timer(Sender: TObject);
begin
a := random (5);
if a = 0 then
shape1.Brush.Color :=clFuchsia
else if a=1 then
shape1.Brush.color :=clAqua
else if a=2 then
shape1.Brush.Color :=clYellow
else if a=3 then
shape1.Brush.color :=clNavy
else
shape1.Brush.Color :=clTeal
end;
procedure TForm1.Timer4Timer(Sender: TObject);
begin
d := random (5);
if d = 0 then
shape4.Brush.Color :=clFuchsia
else if d=1 then
shape4.Brush.color :=clAqua
else if d=2 then
shape4.Brush.Color :=clYellow
else if d=3 then
shape4.Brush.color :=clNavy
else
shape4.Brush.Color :=clTeal
end;
procedure TForm1.Timer5Timer(Sender: TObject);
begin
e := random (5);
if e = 0 then
shape5.Brush.Color :=clFuchsia
else if e=1 then
shape5.Brush.color :=clAqua
else if e=2 then
shape5.Brush.Color :=clYellow
else if e=3 then
shape5.Brush.color :=clNavy
else
shape5.Brush.Color :=clTeal
end;
end.
Tidak ada komentar:
Posting Komentar