From 47e2c125f58187aa0a9a9191fe61e2f2eb079d37 Mon Sep 17 00:00:00 2001 From: Michael Chen Date: Thu, 11 Jan 2018 19:05:22 +0100 Subject: [PATCH] Glitchfix (Ball no longer gets stuck in Paddle easily) --- breakout.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/breakout.c b/breakout.c index d2bf4cf..19bdec2 100644 --- a/breakout.c +++ b/breakout.c @@ -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 }