Ver Mensaje Individual
  #15  
Antiguo 26-12-2007
Avatar de Caral
[Caral] Caral is offline
Miembro Premium
 
Registrado: ago 2006
Posts: 7.659
Reputación: 25
Caral Va por buen camino
Hola
Muy simpático el juego.
Coloca un componente Updow un edit mas y un boton.
En el edit le pones en text 50, sera el minimo.
En el updow le pones en increment 5, para que valla de 5 en 5, en Min 50 y en max 250.
El Updow en eventos:
Associate: Edit2
Aqui pongo el codigo completo, asi lo veras mejor.
Código Delphi [-]
procedure TForm1.FormKeyDown(Sender: TObject; var Key: Word;
  Shift: TShiftState);
begin

case key of
vk_left:
        image2.Left:=image2.Left-8;
vk_right:
        image2.Left:=image2.left+8;
vk_up:
        begin
        timer2.Interval:=10;
        image3.Visible:=true;
        image3.Left:=image2.Left+30;
        end;
end;
end;

procedure TForm1.Timer1Timer(Sender: TObject);
begin
image1.left:=image1.left+10;
w:=image1.left;
x:=image1.left+104;
y:=image1.top;
z:=image1.top+40;
if image1.left>500 then
  image1.left:=0;
end;

procedure TForm1.Timer2Timer(Sender: TObject);
begin
image1.Visible:=true;
image3.Top:=image3.top-5;
image3.Visible:=true;
if image3.Topthen
  begin
  timer2.interval:=0;
  image3.Visible:=false;
  image3.Top:=376;
  image4.Visible:=false;
  end;
if (image3.top>=y) and (image3.top<=z) then
  if (image3.left>=w) and (image3.left<=x) then
    begin
    image1.Left:=0;
    image4.Visible:=true;
    image4.Top:=image3.Top-15;
    image4.Left:=image3.Left-10;
    image1.Visible:=false;

    s:=s+10;
    str((s+0),p);
    edit1.text:=p;
    If Edit1.Text = '200' then
    begin
    Timer1.Enabled:= False;
    Showmessage('gano');
    Button1.Enabled:= true;
    Edit1.Text := '0';
    s:= 0;
    end;
    end;
end;

procedure TForm1.Edit2Change(Sender: TObject);
begin
   timer1.interval:= StrToInt(Edit2.Text);
end;

procedure TForm1.UpDown1Changing(Sender: TObject;
  var AllowChange: Boolean);
begin
   timer1.interval:= UpDown1.Increment;
end;

procedure TForm1.FormMouseDown(Sender: TObject; Button: TMouseButton;
  Shift: TShiftState; X, Y: Integer);
begin
    Edit2.Enabled:= True;
end;

procedure TForm1.Image2Click(Sender: TObject);
begin
    Edit2.Enabled:= False;
end;

procedure TForm1.Button1Click(Sender: TObject);
begin
   Timer1.Enabled:= True;
   Button1.Enabled:= false;
end;

end.
Saludos
Responder Con Cita