Nagut, aber bei so etwas verliert man doch den Überblick
:
Delphi-Quellcode:
//Ballkollision
if (Abs(ball.Left - enemy.left) <= 5) and (Abs(ball.Top - enemy.Top) <= 5) then xspeed:= -xspeed;
if (ball.top > player1.top -1-toleranz) and (ball.top < player1.top + player1.height +1+toleranz) and (ball.left = player1.left+player1.width) then xspeed := -xspeed;
//Ballkollisions Ton
if (Abs(ball.Left - enemy.left) <= 5) and (Abs(ball.Top - enemy.Top) <= 5) then mp1;
if (ball.top > player1.top -1-toleranz) and (ball.top < player1.top + player1.height +1+toleranz) and (ball.left = player1.left+player1.width) then mp1;
Wie wäre es mit
Delphi-Quellcode:
if (Abs(ball.Left - enemy.left) <= 5) and (Abs(ball.Top - enemy.Top) <= 5)
or (ball.top > player1.top - 1 - toleranz) and (ball.top < player1.top + player1.height + 1 + toleranz) and (ball.left = player1.left + player1.width) then
begin
xspeed := -xspeed;
mp1;
end;
?
Und was ist überhaupt "enemy" und "ball" ? Doch hoffentlich keine TImages
?