Documentos de Académico
Documentos de Profesional
Documentos de Cultura
2.
Cree una forma con los controles que se detallan en la siguiente figura :
3.
Defina las variables globales y asigne los eventos Click a los dos botones, as :
var
palabra,
prueba
fallos
: String;
: Integer;
fallos := 0;
image2.Left := image1.left + 136;
image2.top := image1.top + 80;
end;
procedure TForm1.Button2Click(Sender: TObject);
var
letra
: char;
i
: integer;
acierto : Boolean;
begin
letra := upcase(edit1.text[1]);
edit1.text := '';
acierto := false;
for i := 1 to length(palabra) do
if palabra[i] = letra then
begin
prueba[i] := letra;
acierto := True;
end;
label1.caption := prueba;
if Palabra = Prueba then
begin
label1.caption := 'Salvado !';
image2.Left := image1.left + 64;
image2.top := image1.top + 120;
end;
if not acierto then
begin
fallos := fallos + 1;
if fallos = 6 then
begin
label1.caption := 'Ahorcado !';
image2.Left := image1.left + 16;
image2.top := image1.top + 56;
end
else begin
image2.Left := image2.left - 15;
image2.top := image2.top - 15;
end;
end;
end;