linkedin facebook linkedin facebook nod32

Delphi da harkatlanuvchi kema rasmi

Muallif: Mengliyev Sh.

Qo`shilgan sana: 2015-06-14

Delphi da harkatlanuvchi kema rasmi

Delphida harakatlnuvchi kema quyidagi ko`rinishda rasm 1.

Rasm 1.

Dastur kodi:

unit Unit16;

interface

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

type
TForm16 = class(TForm)
Timer1: TTimer;
procedure Timer1Timer(Sender: TObject);
procedure FormActivate(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;

var
Form16: TForm16;
x, y: integer; // kema kordinatasi
implementation

{$R *.dfm}

procedure Titanik(x, y: integer; // kordinata baza nuqtasi
color: TColor); // kema rangi
const
dx = 5;
dy = 5;
var
buf: TColor;
begin
with form16.canvas do
begin
buf := pen.Color; // Joriy rang
pen.Color := color; // kerakli rangni o`rnatish
// rasm ...
// korpus
MoveTo(x, y);
LineTo(x, y - 2 * dy);
LineTo(x + 10 * dx, y - 2 * dy);
LineTo(x + 11 * dx, y - 3 * dy);
LineTo(x + 17 * dx, y - 3 * dy);
LineTo(x + 14 * dx, y);
LineTo(x, y);
// jihozlar
MoveTo(x + 3 * dx, y - 2 * dy);
LineTo(x + 4 * dx, y - 3 * dy);
LineTo(x + 4 * dx, y - 4 * dy);
LineTo(x + 13 * dx, y - 4 * dy);
LineTo(x + 13 * dx, y - 3 * dy);
MoveTo(x + 5 * dx, y - 3 * dy);
LineTo(x + 9 * dx, y - 3 * dy);
// Terish
Rectangle(x + 8 * dx, y - 4 * dy, x + 11 * dx, y - 5 * dy);
// kema turbasi
Rectangle(x + 7 * dx, y - 4 * dy, x + 8 * dx, y - 7 * dy);
// charog`bonlik
Ellipse(x + 11 * dx, y - 2 * dy, x + 12 * dx, y - 1 * dy);
Ellipse(x + 13 * dx, y - 2 * dy, x + 14 * dx, y - 1 * dy);
// machta
MoveTo(x + 10 * dx, y - 5 * dy);
LineTo(x + 10 * dx, y - 10 * dy);
// asbob uskuna
MoveTo(x + 17 * dx, y - 3 * dy);
LineTo(x + 10 * dx, y - 10 * dy);
LineTo(x, y - 2 * dy);
pen.Color := buf; // Qalamning oldingi rangi o`rnatish
end;
end;

procedure TForm16.FormActivate(Sender: TObject);
begin
x := 0;
y := 100;
Form16.Color := clNavy;
Timer1.Interval := 50; // 50 мСек da faqtda signal berish
end;

procedure TForm16.Timer1Timer(Sender: TObject);
begin
Titanik(x, y, form16.color); // Rasmni harakatlantirish
if x < Form16.ClientWidth then
x := x + 5
else
begin // yangi rasm chiqishi
x := 0;
y := Random(50) + 100;
end;
Titanik(x, y, clWhite); // Yangi rasmni chizish
end;

end.

1389 marta o`qildi.

Foydalanuvchi ismi: assom rassom
Qo`shilgan sana: 2015-06-15

yahshi

Parol:
Eslab qolish.


Ro`yhatdan o`tish

testing

+998915878681

Siz o`z maxsulotingizni 3D reklama ko`rinishda bo`lishini xohlaysizmi? Unda xamkorlik qilamiz.

3D Reklama


Рейтинг@Mail.ru
Рейтинг@Mail.ru

Besucherzahler
счетчик посещений