Pong.k question

23 views
Skip to first unread message

Trygve Reenskaug

unread,
Apr 16, 2016, 11:09:37 AM4/16/16
to DCI-object-composition
I am investigating how the direction switches from down to up in the invisible part of the pong process. Attached is a trace of velocities and positions. I can't find where the program changes the sign of the y-velocity:
    velX=-7 velY=7 ballX=498 ballY=1450
     velX=-7 velY=-7 ballX=491 ballY=1443
I'll be grateful for a hint.

trace.txt
pong-05.docx

héctor

unread,
Apr 18, 2016, 1:09:20 PM4/18/16
to object-composition

It seems that BALL.bouncingOffOfPaddle returns true when the ball is invisible and moving down. It happens that the PADDLE contains BALL.x, and BALL.y is greater than PADDLE.vertical.


Also, I think that something misleading is the name of the script vertical in the role PADDLE, it should actually be called horizontal.


Trygve Reenskaug

unread,
Apr 18, 2016, 2:03:38 PM4/18/16
to object-co...@googlegroups.com
Yes, but where does it bounce off the bottom and start going up?

héctor

unread,
Apr 18, 2016, 2:16:35 PM4/18/16
to object-composition
On Monday, April 18, 2016 at 2:03:38 PM UTC-4, trygve wrote:
Yes, but where does it bounce off the bottom and start going up?
 

Where the ball bounces (goes up) it depends on the position of the paddle. The ball starts going up when the BALL.x ins contained in paddle's width, this is PADDLE.contains(x) returns true.


Reply all
Reply to author
Forward
0 new messages