Урок на делфи 51. Танцующий снеговик


задание на delphi. снеговик танцует

unit Unit1;
interface
uses
Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants, System.Classes, Vcl.Graphics,
Vcl.Controls, Vcl.Forms, Vcl.Dialogs, Vcl.StdCtrls, Vcl.ExtCtrls;
type
TForm1 = class(TForm)
Shape1: TShape;
Shape2: TShape;
Shape3: TShape;
Shape4: TShape;
Shape5: TShape;
Shape6: TShape;
Shape7: TShape;
Shape8: TShape;
Shape9: TShape;
Shape10: TShape;
Shape11: TShape;
Shape13: TShape;
Shape14: TShape;
Shape15: TShape;
Shape16: TShape;
Shape17: TShape;
Button1: TButton;
Timer1: TTimer;
Shape18: TShape;
Shape19: TShape;
Shape20: TShape;
Shape21: TShape;
Shape22: TShape;
procedure Timer1Timer(Sender: TObject);
procedure Button1Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
procedure TForm1.Button1Click(Sender: TObject);
begin
Timer1.Enabled:=true;
end;
procedure TForm1.Timer1Timer(Sender: TObject);
begin
if Shape7.Top<=150 then
Shape7.Tag:=0;
if Shape7.Top>=170 then
Shape7.Tag:=1;
if (Shape7.Tag=0) and (Shape8.Tag=0) then
Shape7.Top:=Shape7.Top+1
else
Shape7.Top:=Shape7.Top-1;
if Shape8.Top<=110 then
Shape8.Tag:=0;
if Shape8.Top>=180 then
Shape8.Tag:=1;
if Shape8.Tag=0 then
Shape8.Top:=Shape8.Top+3
else
Shape8.Top:=Shape8.Top-3;
if Shape9.Top<=80 then
Shape9.Tag:=0;
if Shape9.Top>=230 then
Shape9.Tag:=1;
if (Shape9.Tag=0) and (Shape8.Tag=0) then
Shape9.Top:=Shape9.Top+5
else
Shape9.Top:=Shape9.Top-5;
if Shape18.Top<=90 then
Shape18.Tag:=0;
if Shape18.Top>=250 then
Shape18.Tag:=1;
if (Shape18.Tag=0) and (Shape9.Tag=0)and (Shape8.Tag=0) then
Shape18.Top:=Shape18.Top+5
else
Shape18.Top:=Shape18.Top-5;
if Shape3.left<=220 then
Shape3.Tag:=0;
if Shape3.left>=260 then
Shape3.Tag:=1;
if (Shape3.Tag=0) then
Shape3.left:=Shape3.left+1
else
Shape3.left:=Shape3.left-1;
if Shape21.Top<=55 then
Shape21.Tag:=0;
if Shape21.Top>=65 then
Shape21.Tag:=1;
if (Shape21.Tag=0) then
Shape21.Top:=Shape21.Top+1
else
Shape21.Top:=Shape21.Top-1;
end;
end.



Скачать