Glitchfix (Ball no longer gets stuck in Paddle easily)
This commit is contained in:
parent
bb164e51d8
commit
47e2c125f5
@ -153,11 +153,13 @@ void BALL_SteerMomentum(Ball * obj, Paddle * paddle){
|
|||||||
}
|
}
|
||||||
|
|
||||||
void BALL_Update(Ball * obj, Paddle * paddle){
|
void BALL_Update(Ball * obj, Paddle * paddle){
|
||||||
|
Vector oldMomentum = obj->Momentum;
|
||||||
|
|
||||||
(obj->Rotation) += (obj->RotationValue);
|
(obj->Rotation) += (obj->RotationValue);
|
||||||
(obj->Location) = vectorAdd((obj->Location), (obj->Momentum));
|
(obj->Location) = vectorAdd((obj->Location), oldMomentum);
|
||||||
|
|
||||||
if (BALL_CollideWithRect(obj, &(paddle->TargetRect))) {
|
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);
|
BALL_SteerMomentum(obj, paddle);
|
||||||
(obj->Location) = vectorAdd((obj->Location), (obj->Momentum)); // Maybe remove this
|
(obj->Location) = vectorAdd((obj->Location), (obj->Momentum)); // Maybe remove this
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user