Программирование - это просто
Advertisement
arrow Delphi arrow Delphi arrow DelphiX (TDXDraw, TDXTimer, Delphi, TDXImageList)
07.02.2023 .
1:
C#
Delphi
Web-
Excel-
.
DelphiX (TDXDraw, TDXTimer, Delphi, TDXImageList) E-mail
megabax   
28.12.2010 .
New Page 2

DelphiX  (TDXDraw, TDXTimer, Delphi, TDXImageList)

.

, . :

  • , .
  • , "", , ( ).
  • .

,

, :

:

  TPlayerSprite = class(TImageSprite)       //

  protected

     Distance:integer;    //

     oldDistance:integer; //

     procedure DoMove(MoveCount: Integer); override; //

  end;

TExploit ():

  TExploit=class(TImageSprite)

  protected

    procedure DoCollision(Sprite: TSprite; var Done: Boolean); override;

    procedure DoMove(MoveCount: Integer); override;

  public

    constructor Create(AParent: TSprite); override;

    destructor Destroy; override;

  end;

( ):

// ************** TExploit *********

procedure TExploit.DoCollision(Sprite: TSprite; var Done: Boolean);

begin

  Collision;

end;

 

Procedure TExploit.DoMove(MoveCount: Integer);

Begin

  inherited DoMove(MoveCount);

end;

 

constructor TExploit.Create(AParent: TSprite);

begin

  inherited Create(AParent);

end;

 

destructor TExploit.Destroy;

begin

  inherited Destroy; //

end;

:

Procedure TBullet.DoMove(MoveCount: Integer);

Begin

  inherited DoMove(MoveCount);

  y:=y-5;  // , ?

  if y<50 then Dead // ,

end;

, :

procedure TSpider.DoCollision(Sprite: TSprite; var Done: Boolean);

begin

  // TBullet,

  if Sprite is TBullet then dead;

  Collision; //

  with TExploit.Create(Engine) do

     begin

       PixelCheck := True;

       Image := frmDelphiX1.dxImageList.Items.Find('Shoot');

       X := Self.X;

       Y := Self.Y;

       Width := Image.Width;

       Height := Image.Height;

       AnimCount := Image.PatternCount;

       AnimLooped := False;

       AnimSpeed := 3/1000;

       AnimPos := 0;

     end;

end;

, TPlayerSprite.DoMove:

Procedure TPlayerSprite.DoMove(MoveCount: Integer);

begin

    inherited DoMove(MoveCount);

    //

    if isLeft in frmDelphiX1.DXInput.States then x:=x-5;

    //

    if isRight in frmDelphiX1.DXInput.States then x:=x+5;

    //

    if isup in frmDelphiX1.DXInput.States then

    begin

      if Distance-oldDistance>=17 then

      begin

         Inc(Distance);

         with TBullet.Create(Engine) do

         begin

           PixelCheck := True;

           Image := frmDelphiX1.dxImageList.Items.Find('Bullet');

           //

           X := Self.X+Self.Width  -40;

           //

           Y := Self.Y+Self.Height -80;

           Width := Image.Width;

           Height := Image.Height+2;

         end;

      end;

      oldDistance := Distance; // -

      Distance:=0;

    end;

    if  y >= frmDelphiX1.DXDraw.SurfaceHeight-image.Height then  //

      y := frmDelphiX1.DXDraw.SurfaceHeight-image.Height;        //

    if  x >= frmDelphiX1.DXDraw.SurfaceWidth -image.Width  then  //

      x := frmDelphiX1.DXDraw.SurfaceWidth -image.Width;         //

    if  y <= 0 then  y := 1;

    if  x <= 0 then  x:=1;

    Distance:=Distance+MoveCount

end;

( ):

procedure TfrmDelphiX1.FormCreate(Sender: TObject);

begin

  i:=true;

  with TSpider.Create(DXSpriteEngine.Engine) do

  begin

     PixelCheck := True;            //

     Image := frmDelphiX1.dxImageList.Items.Find('Spider'); // ImageList`

     x:=10; // x

     y:=100;  // y

     Width := Image.Width;          //

     Height := Image.Height;        //

   end;

   with TPlayerSprite.Create(DXSpriteEngine.Engine) do

   begin

     PixelCheck := True;

     Image := frmDelphiX1.dxImageList.Items.Find('GameUnit');

     x:=500;

     y:=500;

     Width := Image.Width;

     Height := Image.Height;

   end;

end;

, "" .   TDXImageList Items*:

    DelphiX (TDXDraw, TDXTimer, Delphi, TDXImageList)

(Shoot) *:

    DelphiX (TDXDraw, TDXTimer, Delphi, TDXImageList)

, ( PatternHeight PatternWidth), Picture :

    DelphiX (TDXDraw, TDXTimer, Delphi, TDXImageList)

, *:

    DelphiX (TDXDraw, TDXTimer, Delphi, TDXImageList)

, . . 48, 192= 48*4.

:

    DelphiX (TDXDraw, TDXTimer, Delphi, TDXImageList)

, . , , .


, *,   . 1274 "Delphi", Borland Delphi.. 


 

 

( 06.11.2011 . )
 
« .   . »
 
© 2023 Программирование - это просто
Joomla! - , GNU/GPL.
© 2005-2008 Joom.Ru - Joomla!
Design by Mamboteam.com | Powered by Mambobanner.de
  .