H, I attach some of the code on a new game I'm working on. If the ball moves past a certain value of x then I want it to be killed/destroyed/made invisible... how do I do that? I've tried the following in the DoMove Procedure:

if x < 100 then
ball.dead

It works because the ball does not respond to my mouse action past that point but the image remains......how does one get rid of the image?

Thanks for your help :-)


Code:
procedure TBall.DoMove&#40;MoveCount &#58; integer&#41;;
begin
  if MoveLeft then
  x&#58;= x - 50;
  if MoveRight then
  X&#58;= X + 50;
end;

procedure TForm1.DXDraw1Initialize&#40;Sender&#58; TObject&#41;;
begin
  wallpaper &#58;= TDirectDrawsurface.Create&#40;DXDraw1.ddraw&#41;;
  wallpaper.LoadFromGraphic&#40;Form1.DXImagelist1.Items.Items&#91;1&#93;.picture.graphic&#41;;
  Ball &#58;= tball.Create&#40;Form1.DXSpriteEngine1.Engine&#41;;
  Ball.SpriteImg &#58;= TDirectDrawsurface.Create&#40;DXDraw1.ddraw&#41;;
  Ball.SpriteImg.LoadFromGraphic&#40;Form1.DXImagelist1.items.items&#91;0&#93;.picture.graphic&#41;;
  ball.SpriteImg.TransparentColor&#58;=clblack;
  ball.x&#58;=350;
  ball.y&#58;=200;
  dxTimer1.Enabled &#58;= true;
end;

procedure TForm1.DXTimer1Timer&#40;Sender&#58; TObject; LagCount&#58; Integer&#41;;
begin
  if not DXDraw1.CanDraw then Exit;
  DXInput1.Update;
  DXSpriteEngine1.Move&#40;1&#41;;
  dxdraw1.Surface.Draw&#40;-10,-10, wallpaper.ClientRect, wallpaper,false&#41;;
  dxdraw1.surface.draw&#40;round&#40;ball.X&#41;,round&#40;ball.Y&#41;,
  ball.SpriteImg.ClientRect, ball.SpriteImg,true&#41;;
  DXDraw1.Flip;
end;