Make your own free website on Tripod.com

Kayan yazı

 

procedure TForm1.FormCreate(Sender: TObject);
begin
timer1.Interval:=250;
caption:='MERHABA ARAKADAŞLAR';
end;

procedure TForm1.Timer1Timer(Sender: TObject);
begin
caption:=copy(caption,2,length(caption)-1)+caption[1];
end

 

yılan oyunu

 

unit Unit1;

interface

uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, ExtCtrls, StdCtrls, jpeg;

type
TForm1 = class(TForm)
Image1: TImage;
Timer1: TTimer;
Timer2: TTimer;
Timer3: TTimer;
Timer4: TTimer;
Timer5: TTimer;
Edit1: TEdit;
Edit2: TEdit;
Edit3: TEdit;
Button1: TButton;
Edit4: TEdit;
procedure FormCreate(Sender: TObject);
procedure Timer1Timer(Sender: TObject);
procedure Timer2Timer(Sender: TObject);
procedure Timer3Timer(Sender: TObject);
procedure Timer4Timer(Sender: TObject);
procedure FormKeyDown(Sender: TObject; var Key: Word;
Shift: TShiftState);
procedure Timer5Timer(Sender: TObject);
procedure FormClose(Sender: TObject; var Action: TCloseAction);
procedure Button1Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;

var
Form1: TForm1;

implementation

{$R *.dfm}

procedure TForm1.FormCreate(Sender: TObject);
begin
canvas.MoveTo(250,250);
canvas.Pen.Width:=canvas.Pen.Width+5;
button1.Click;
timer1.Enabled:=true;
end;

procedure TForm1.Timer1Timer(Sender: TObject);
var
x,y :integeR;
begin
x:=canvas.PenPos.X;
y:=canvas.PenPos.Y;
form1.Refresh;
canvas.LineTo(x+StrToInt(edit1.Text),y);
end;

procedure TForm1.Timer2Timer(Sender: TObject);
var
x,y :integeR;
begin
x:=canvas.PenPos.X;
y:=canvas.PenPos.Y;
form1.Refresh;
canvas.LineTo(x-StrToInt(edit1.Text),y);

end;

procedure TForm1.Timer3Timer(Sender: TObject);
var
x,y :integeR;
begin
x:=canvas.PenPos.X;
y:=canvas.PenPos.Y;
form1.Refresh;
canvas.LineTo(x,y-StrToInt(edit1.Text));
end;


procedure TForm1.Timer4Timer(Sender: TObject);
var
x,y :integeR;
begin
x:=canvas.PenPos.X;
y:=canvas.PenPos.Y;
form1.Refresh;
canvas.LineTo(x,y+StrToInt(edit1.Text));
end;


procedure TForm1.FormKeyDown(Sender: TObject; var Key: Word;
Shift: TShiftState);
begin
if key= vk_left then
begin
if not (timer1.Enabled = true) then
begin
timer1.Enabled:=false;
timer2.Enabled:=true;
timer3.Enabled:=false;
timer4.Enabled:=false;
end;
end;
if key= vk_right then
begin
if not (timer2.Enabled = true) then
begin
timer1.Enabled:=true;
timer2.Enabled:=false;
timer3.Enabled:=false;
timer4.Enabled:=false;
end;
end;
if key= vk_up then
begin
if not (timer4.Enabled = true) then
begin
timer1.Enabled:=false;
timer2.Enabled:=false;
timer3.Enabled:=true;
timer4.Enabled:=false;
end;
end;
if key= vk_down then
begin
if not (timer3.Enabled = true) then
begin
timer1.Enabled:=false;
timer2.Enabled:=false;
timer3.Enabled:=false;
timer4.Enabled:=true;
end;
end;
if (ssalt in shift) and (key = vk_f5) then
begin
canvas.MoveTo(image1.Left+10,image1.Top+50);
timer1.Enabled:=false;
timer2.Enabled:=false;
timer3.Enabled:=true;
timer4.Enabled:=false;
end;
if (ssalt in shift) and (key = vk_f3) then
begin
button1.Click;
end;
end;


procedure TForm1.Timer5Timer(Sender: TObject);
var
x,y:integer;
begin
x:=canvas.PenPos.X;
y:=canvas.PenPos.Y;
if x<0 then
canvas.MoveTo(form1.Width,y);
if y<0 then
canvas.MoveTo(x,form1.Height);
if x>form1.Width then
canvas.MoveTo(0,y);
if y>form1.Height then
canvas.MoveTo(x,0);
if (X>image1.Left) and (x<image1.Left+image1.Width) and (y>image1.Top) and (y<image1.Top+image1.Height) then
begin
button1.Click;
edit4.Text:=Inttostr(StrToInt(edit4.Text)+1)
end;
end;



procedure TForm1.FormClose(Sender: TObject; var Action: TCloseAction);
begin
showmessage(edit4.Text+' Yem yediniz');
end;

procedure TForm1.Button1Click(Sender: TObject);
begin
image1.Left:=random(form1.Width);
image1.Top:=random(form1.Height);
edit1.Text:=Inttostr(StrToInt(edit1.Text)+2);
timer1.Interval:=timer1.Interval+1;
timer2.Interval:=timer2.Interval+1;
timer3.Interval:=timer3.Interval+1;
timer4.Interval:=timer4.Interval+1;
end;

end.