Hot answers tagged

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.
user avatar
  • 18.3k
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);
user avatar
  • 186
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 ...
user avatar
  • 17.4k
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. ...
user avatar
1 vote

detect collision paddle Pset4

Try to change the == in the object detection section with either >= or <=
user avatar
  • 1,156

Only top scored, non community-wiki answers of a minimum length are eligible