Autor Beitrag
LinzerASK
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 135

WIN XP
Delphi 4, Delphi 2005
BeitragVerfasst: Do 23.03.06 20:46 
hallo!

ich programmiere gerade ein tischtennisspiel:

ich habe bereits programmiert dass man zwei shapes auf und ab bewegen kann, also für 2 spieler.
der ball bewegt sich auch schon
nur wie kann ich jetzt programmieren dass, wenn der ball auf die beiden shapes kommt wieder zurückkommt?

ausblenden Quelltext
1:
2:
3:
4:
if shape2.top>=5 then if key='ü' then shape2.top:=shape2.top-8;
if shape1.top>=5 then if key='q' then shape1.top:=shape1.top-8;
if shape2.top+shape2.height<=clientheight-5 then if key='ö' then shape2.top:=shape2.top+8;
if shape1.top+shape1.height<=clientheight-5 then if key='a' then shape1.top:=shape1.top+8;


dass ist meine testenbelegung

gut, aber jetzt ist das problem, wie prallt der ball vom schläger ab,
ich habe es soweit das er an allen seiten abprallt, doch am schläger?

für alle 4 seiten:

ausblenden Quelltext
1:
2:
3:
4:
5:
6:
7:
if image1.Left >= form1.clientwidth - image1.width then dx:=-dx;

if image1.Left < 0 then dx:=-dx;

if image1.top >= form1.clientheight - image1.height then dy:=-dy;

if image1.top < 0 then dy:=-dy;
juKx
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 45

WinXp Pro Sp2
Delphi 7 Enterprise Edition
BeitragVerfasst: Do 23.03.06 21:08 
hi,

na Eintrittswinkel ist gleich Austrittswinkel...

konkret:

ausblenden Quelltext
1:
2:
 
vx:=vx*(-1) //vx geschwindigkeit...

_________________
ausblenden Quelltext
1:
Ich programmiere sehr gerne, bloß mein Rechner nicht, Oo!					
LinzerASK Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 135

WIN XP
Delphi 4, Delphi 2005
BeitragVerfasst: Do 23.03.06 21:12 
Titel: schläger
ja, nur wie kann ich jetzt programmieren das er sowohl am linken und rechten schläger abprallt der ball.

2.)was muss ich machen wenn der ball neben dem schläger raus geht