PDA

View Full Version : Need Lazarus Help



Footy
11-20-2012, 09:25 PM
Hey Guys,

I'm fiddling around with lazarus again, trying to do some stuff, but I don't know where I'm screwing up... I'm trying to make a ball bounce around my screen, thats it, but the ball just goes off the bottom of the screen. Could someone hint towards where I screwed up? I cant figure it out... :confused:

Image1 Is a 50x50 picture of a ball.


procedure TForm1.Timer1Timer(Sender: TObject);
var
LeftRight, UpDown:boolean;
begin
if Image1.Left <= 0 then
LeftRight := False;
if (Image1.Width + Image1.Left) >= Width then
LeftRight := True;
if Image1.Top <= 0 then
UpDown := False;
if (Image1.Height + Image1.top) >= Height then
Updown := True;

if updown = True then
Image1.Top := Image1.Top + 1 else
Image1.Top := Image1.Top - 1;
if LeftRight = True then
Image1.Left := Image1.Left + 1 else
Image1.Left := Image1.Left - 1
end;