Thanks for your replies guys :-)

JasonF, I actualy saw a version of the code in Traveller's game called Baloons. The reason why I tried it is because I was struggling to get an image displayed over a bitmap.

FNX, your suggestion of using a boolean works, it now does what I want it to do :-)

My code:

[pascal]
procedure TBall.DoMove(MoveCount : integer);
begin
if MoveLeft then
x:= x - 50;
if (x = 100) then
BallIsDead := True;
end;

procedure TForm1.DXDraw1Initialize(Sender: TObject);
begin
wallpaper := TDirectDrawsurface.Create(DXDraw1.ddraw);
wallpaper.LoadFromGraphic(Form1.DXImagelist1.Items .Items [1].picture.graphic);
Ball := tball.Create(Form1.DXSpriteEngine1.Engine);
Ball.SpriteImg := TDirectDrawsurface.Create(DXDraw1.ddraw);
Ball.SpriteImg.LoadFromGraphic(Form1.DXImagelist1. items.items[0].picture.graphic);
ball.SpriteImg.TransparentColor:=clblack;
ball.x:=350;
ball.y:=200;
dxTimer1.Enabled := true;
end;

procedure TForm1.DXTimer1Timer(Sender: TObject; LagCount: Integer);
begin
if not DXDraw1.CanDraw then Exit;
DXInput1.Update;
DXSpriteEngine1.Move(1);
dxdraw1.Surface.Draw(-10,-10, wallpaper.ClientRect, wallpaper,false);
if (BallisDead = False) then
dxdraw1.surface.draw(round(ball.X),round(ball.Y),
ball.SpriteImg.ClientRect, ball.SpriteImg,true);
DXDraw1.Flip;
end;
[/pascal]

PS. At the moment my ball moves left and right with the OnMouseDown event. How can I get it to move diagonally ie outside the limits of always up/down or left/right?

Thanks again :-)

[/pascal]