Class TSprite

DescriptionHierarchyFieldsMethodsProperties

Unit

Declaration

type TSprite = class(TObject)

Description

The sprite engines base class.

Hierarchy

Overview

Methods

Public constructor Create(AParent:TSprite); virtual;
Public destructor Destroy; override;
Public procedure Move(TimeGap:double);
Public procedure Draw; virtual;
Public procedure Dead; virtual;
Public procedure Restore;
Public procedure Clear;
Public function Collision:integer;
Public procedure Collision2;
Public function CountOfClass(AClass:TSpriteClass):integer;
Public procedure Optimize;
Public function GetSpriteAt(X,Y:integer):TSprite; virtual;
Public procedure GetSpritesAt(const AX, AY: Integer; ASprites: TSpriteList; AClass : TSpriteClass); overload; virtual;
Public procedure GetSpritesAt(const AX, AY: Integer; ASprites: TSpriteList); overload; virtual;

Properties

Public property Parent: TSprite read FParent write SetParent;
Public property Engine: TSpriteEngine read FEngine;
Public property BoundsRect: TAdRect read GetBoundsRect;
Public property Items: TSpriteList read FList;
Public property GridSize: integer read FGridSize write SetGridSize;
Public property CollisionOptimizationTyp: TCollisionTyp read FCollisionTyp write SetCollisionOptimization;
Public property SpriteField: TAd2DSpriteList read FSpriteField;
Public property CollisionTester: TAdSpriteCollisionTester read FCollisionTester write FCollisionTester;
Published property X: double read FX write SetX;
Published property Y: double read FY write SetY;
Published property Z: integer read FZ write SetZ;
Published property Width: double read FWidth write SetWidth;
Published property Height: double read FHeight write SetHeight;
Published property WorldX: double read GetWorldX;
Published property WorldY: double read GetWorldY;
Published property Deaded: boolean read FDead;
Published property VisibilityTest: boolean read FVisibilityTest write FVisibilityTest;
Published property CanDoCollisions: boolean read FDoCollisions write FDoCollisions;
Published property CanDoMoving: boolean read FDoMoving write FDoMoving;
Published property Visible: boolean read FVisible write FVisible;
Published property AutoOptimize: boolean read FAutoOptimize write FAutoOptimize;

Description

Methods

Public constructor Create(AParent:TSprite); virtual;

Creates an instance of TSprite.

Public destructor Destroy; override;

Destroyes the instance.

Public procedure Move(TimeGap:double);

Calls the instance's DoMove function and all child's move function.

Public procedure Draw; virtual;

Calls the instance's DoDraw function and all childs' draw function.

Public procedure Dead; virtual;

Tells the engine that this instance of TSprite wants to bee freed.

Public procedure Restore;

Gives all sprites the posibility to restore their setings - eg. for Lights in Splitscreenmode

Public procedure Clear;

Deletes all sprites

Public function Collision:integer;

Checks whether this sprite collides with another sprite in the spriteengine. Returns the count of sprites.

Public procedure Collision2;

Checks whether this sprite collides to the sprite, that wants to know whether it collides with another sprite.

Public function CountOfClass(AClass:TSpriteClass):integer;

Returns the count of a sprite class

Public procedure Optimize;

Optimzes the optimization field

Public function GetSpriteAt(X,Y:integer):TSprite; virtual;

Returns one sprite at the specified position

Public procedure GetSpritesAt(const AX, AY: Integer; ASprites: TSpriteList; AClass : TSpriteClass); overload; virtual;

Returns all sprites at the specified position and of a specified type

Public procedure GetSpritesAt(const AX, AY: Integer; ASprites: TSpriteList); overload; virtual;
 

Properties

Public property Parent: TSprite read FParent write SetParent;

The parent sprite you've set into the constructor.

Public property Engine: TSpriteEngine read FEngine;

The sprite engine.

Public property BoundsRect: TAdRect read GetBoundsRect;

Returns a rect which contains the relative coordinates (relative to the screen) of the sprite.

Public property Items: TSpriteList read FList;

Contains all child sprites.

Public property GridSize: integer read FGridSize write SetGridSize;

Sets the size of the sprite field

Public property CollisionOptimizationTyp: TCollisionTyp read FCollisionTyp write SetCollisionOptimization;

Sets the type of the collision optimization.

Public property SpriteField: TAd2DSpriteList read FSpriteField;

Returns the 2D-Matrix in which all sprites are sorted by their position. This Matrix may be used for fast access on the sprites.

Public property CollisionTester: TAdSpriteCollisionTester read FCollisionTester write FCollisionTester;
 
Published property X: double read FX write SetX;

The absolute X Position of the sprite.

Published property Y: double read FY write SetY;

The absolute Y Position of the sprite.

Published property Z: integer read FZ write SetZ;

The Z order of the sprite.

Published property Width: double read FWidth write SetWidth;

The width of the sprite.

Published property Height: double read FHeight write SetHeight;

The height of the sprite.

Published property WorldX: double read GetWorldX;

The relative X Position of the sprite.

Published property WorldY: double read GetWorldY;

The relative Y Position of the sprite.

Published property Deaded: boolean read FDead;

Returns wether this sprite wants to be freed.

Published property VisibilityTest: boolean read FVisibilityTest write FVisibilityTest;

Disable to call the "draw" method of sprites although they aren't visible

Published property CanDoCollisions: boolean read FDoCollisions write FDoCollisions;

Defines whether this sprite is included in the collision system. Equal to DelpiX's "Collisioned".

Published property CanDoMoving: boolean read FDoMoving write FDoMoving;

Defines whether the "DoMove" function is called. Equal to DelphiX's "Moved".

Published property Visible: boolean read FVisible write FVisible;

Defines whether "DoDraw" is called.

Published property AutoOptimize: boolean read FAutoOptimize write FAutoOptimize;

True if the optimization field should be automatically optimized

SourceForge.net Logo


Generated by PasDoc 0.11.0 on 2008-12-31 14:32:00