about summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorCharadon <dev@iotib.net>2022-06-14 19:24:10 -0400
committerCharadon <dev@iotib.net>2022-06-14 19:24:10 -0400
commitbf525fba47c8ea8972bbbd8353b83b607522a194 (patch)
tree16227fd4a5b99678de840dae390bf72296859f0c
parent10af293becc1e2549c698a50bd05bb463a9939ec (diff)
downloadPong-C-bf525fba47c8ea8972bbbd8353b83b607522a194.tar.gz
Fixed issue #5
-rw-r--r--src/marathon.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/marathon.c b/src/marathon.c
index a04519a..c2492a6 100644
--- a/src/marathon.c
+++ b/src/marathon.c
@@ -109,11 +109,19 @@ void marathon_main() {
         MainCamera.offset = (Vector2){0, 0};
         MainCamera.rotation = 0;
     bool MarathonGoing = true;
+	bool HasScored = false;
     while(MarathonGoing == true && GameGoing == true) {
         if (WindowShouldClose()) { //Quit Game if the window is closed.
             GameGoing = false;
         }
 
+		//Prevents multi-scoring in some cases.
+		if (Ball.Direction == LEFT) {
+			HasScored = true;
+		} else {
+			HasScored = false;
+		}
+
         snprintf(PlayerScore, 50, "Player: %d", Player.Score);
         MainCamera.zoom = GetScreenHeight()/720.0f;
 	    MainCamera.offset = (Vector2){GetScreenWidth()/2.0f, GetScreenHeight()/2.0f};