4
votes
Accepted
Ball bounces just above paddle
detectCollision assumes that the width of your ball is RADIUS*2. You have initialized your ball with a width of RADIUS. So detectCollision will return a collision before the ball hits the paddle.
1
vote
Segmentation Fault w/paddle movement (already changed initPaddle return)
GRect initPaddle(GWindow window) your returning a newGRect, does that even compile. You should return the paddle from the line with GRect paddle = newGRect((getWidth(window) - PWT)/2 , PY, PWT, PHT);
1
vote
Accepted
Polygon paddle instead of rect
After a bit of playing with code, it turns out that the problem is caused by getGObjectAt. It doesn't return a pointer to your paddle even though it's in the specified location. Rather, it returns ...
1
vote
detect collision paddle Pset4
One thing that had me for a bit was my functions for instantiating the paddle and the ball.
since we have to program movement inside of main we want ball and paddle exist inside of that function.
...
1
vote
detect collision paddle Pset4
Try to change the == in the object detection section with either >= or <=
Only top scored, non community-wiki answers of a minimum length are eligible
Related Tags
paddle × 12breakout × 9
pset3 × 7
pset4 × 3
ball × 3
bouncing × 2
detectcollision × 2
segmentation-fault × 1
move × 1
return × 1
collision-detection × 1
bounce × 1
moveball × 1