I mention that in the chapter. Basically just take the current position and previous position, then divide the change in X by the width of the ball, checking for collisions at each step.
Of course, you could also put an upper limit on the ball so that it never travels further than (paddle width + ball width) pixels in a single frame.
I mention that in the chapter. Basically just take the current position and previous position, then divide the change in X by the width of the ball, checking for collisions at each step.
Of course, you could also put an upper limit on the ball so that it never travels further than (paddle width + ball width) pixels in a single frame.
groundh0g 4 years ago
Thing is, when the movement gets fast enough, the ball can move right through objects, not noticing it's hit something. How would you get round that?
whothehellisthat 4 years ago