Glitchfix (Ball no longer gets stuck in Paddle easily)

This commit is contained in:
Michael Chen 2018-01-11 19:05:22 +01:00
parent bb164e51d8
commit 47e2c125f5

View File

@ -153,11 +153,13 @@ void BALL_SteerMomentum(Ball * obj, Paddle * paddle){
}
void BALL_Update(Ball * obj, Paddle * paddle){
Vector oldMomentum = obj->Momentum;
(obj->Rotation) += (obj->RotationValue);
(obj->Location) = vectorAdd((obj->Location), (obj->Momentum));
(obj->Location) = vectorAdd((obj->Location), oldMomentum);
if (BALL_CollideWithRect(obj, &(paddle->TargetRect))) {
(obj->Location) = vectorSub((obj->Location), (obj->Momentum)); // Maybe remove this
(obj->Location) = vectorSub((obj->Location), oldMomentum); // Maybe remove this
BALL_SteerMomentum(obj, paddle);
(obj->Location) = vectorAdd((obj->Location), (obj->Momentum)); // Maybe remove this
}