Hi

I'm trying to get my sprite engine up and running, but I need to find a way to control all instances of the sprite class using one method.

TSprite:
[pascal]
type
TSprite = class
private
...
public
X, Y, Z: Integer;
...
procedure Draw();
end;
[/pascal]

Instances:
[pascal]
var
Sprite1, Sprite2: TSprite;
...
[/pascal]

Sprite Engine Class:
[pascal]
type
TSpriteEngine = class
private
...
public
...
procedure DrawAll();
end;

...

procedure TSpriteEngine.DrawAll();
begin
//Here all the instances of TSprite should be drawn...
end;
[/pascal]

I know c/c++ has a way of doing it like this:
Code:
...
for each TSprite
{
 Draw();
};
...
I'm trying to get the sprites to draw once and overlap each other according to the Z value. Is there a way that I can parse through all the instances of TSprite?

Thanks ahead...