Foros Club Delphi

Foros Club Delphi (https://www.clubdelphi.com/foros/index.php)
-   OOP (https://www.clubdelphi.com/foros/forumdisplay.php?f=5)
-   -   Novato solicita ayuda..Juego en Delphi (https://www.clubdelphi.com/foros/showthread.php?t=50336)

Caral 26-12-2007 16:42:25

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

alexxx 08-04-2008 18:08:20

Saludos a los q me ayudaron...!!!
 
Q tal hace unos dias recien me entere q aprobe el curso con 15 (puntaje maximo 1 a 20)
gracias amigos me salvaron de una muerte segura en mi casa...:D
suerte y espero sigan ayudando a mas personas q lo necesiten... ;)

Celta 14-07-2010 03:15:19

Varios Miisiles?
 
hola a todos mi pregunta es como crear varios misiles grasias ..

Caral 14-07-2010 04:25:44

Hola
Aqui estabamos...
Saludos

Ñuño Martínez 14-07-2010 19:10:33

Cita:

Empezado por Celta (Mensaje 370300)
hola a todos mi pregunta es como crear varios misiles grasias ..

Pues creándolos... En serio... De veras... Que no te miento... Si no, bájate las fuentes de Allegro.pas y mira el código fuente.


La franja horaria es GMT +2. Ahora son las 05:51:29.

Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2026, Jelsoft Enterprises Ltd.
Traducción al castellano por el equipo de moderadores del Club Delphi