Thema: Delphi Pong-Klon

Einzelnen Beitrag anzeigen

Benutzerbild von Pr0g
Pr0g

Registriert seit: 21. Mai 2004
809 Beiträge
 
Delphi 7 Personal
 
#24

Re: Pong-Klon

  Alt 19. Nov 2004, 18:44
Zitat von Darty:
Also wo ist die "Physik" in deinem Code ?
Siehst du sie etwas nicht


Ich denke mal das sind die Zeilen der Kollisionsabfrage:

Delphi-Quellcode:
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;
und

Delphi-Quellcode:
if ball.Left<0 then xspeed := -xspeed;

if ball.Top<0 then yspeed := -yspeed;
if ball.Left>445 then xspeed := -xspeed;
if ball.Top>445 then yspeed := -yspeed;
  Mit Zitat antworten Zitat