about summary refs log tree commit diff stats
path: root/src/marathon.c
diff options
context:
space:
mode:
authorCharadon <dev@iotib.net>2022-06-11 23:17:34 -0400
committerCharadon <dev@iotib.net>2022-06-11 23:17:34 -0400
commit05c6ad238e4be9dc10ab832c2f0217931cef9c63 (patch)
tree41c3d61a17e8e1e1b636bc5d81ec5a7b359ccf6d /src/marathon.c
parent9aeea3ebd946f8803fe880c1c6fc98483a002444 (diff)
downloadPong-C-05c6ad238e4be9dc10ab832c2f0217931cef9c63.tar.gz
More work on something. Including a background to the volume bars, fixing some indentation, and beginning work on a screen to show all scores
Diffstat (limited to 'src/marathon.c')
-rw-r--r--src/marathon.c62
1 files changed, 31 insertions, 31 deletions
diff --git a/src/marathon.c b/src/marathon.c
index 135c533..a04519a 100644
--- a/src/marathon.c
+++ b/src/marathon.c
@@ -116,38 +116,38 @@ void marathon_main() {
 
         snprintf(PlayerScore, 50, "Player: %d", Player.Score);
         MainCamera.zoom = GetScreenHeight()/720.0f;
-	MainCamera.offset = (Vector2){GetScreenWidth()/2.0f, GetScreenHeight()/2.0f};
-	MainCamera.target = (Vector2){1280/2.0f, 720/2.0f};
+	    MainCamera.offset = (Vector2){GetScreenWidth()/2.0f, GetScreenHeight()/2.0f};
+	    MainCamera.target = (Vector2){1280/2.0f, 720/2.0f};
 
        	//Controls
-	if(IsKeyDown(KEY_UP)) {
-		Player.Y -= 10;
-	} else if (IsKeyDown(KEY_DOWN)) {
-		Player.Y += 10;
-	} else if(IsKeyPressed(KEY_ESCAPE)) {
-		EnableCursor();
-	} else if(IsMouseButtonPressed(MOUSE_BUTTON_LEFT) || IsCursorHidden() == true) {
-		Player.Y = GetMouseY()-PaddleSprite.height/2.0f;
-		DisableCursor();
-	}
-	
-	if(GetMouseY() < 0) {
-		SetMousePosition(0, 0);
-	} else if(GetMouseY() > 720) {
-		SetMousePosition(0, 720);
-	}
-
-	//Check if players are off-screen
-	if (Player.Y < 0) {
-		Player.Y = 0;
-	} else if (Player.Y > 480) {
-		Player.Y = 480;
-	}
-
-        // Collision
-       	ball(&Player.HitBox, NULL, &Ball, &Player.Score, NULL);
-        //Updates hitbox with player's position.
-	Player.HitBox.y = Player.Y;
+        if(IsKeyDown(KEY_UP)) {
+            Player.Y -= 10;
+        } else if (IsKeyDown(KEY_DOWN)) {
+            Player.Y += 10;
+        } else if(IsKeyPressed(KEY_ESCAPE)) {
+            EnableCursor();
+        } else if(IsMouseButtonPressed(MOUSE_BUTTON_LEFT) || IsCursorHidden() == true) {
+            Player.Y = GetMouseY()-PaddleSprite.height/2.0f;
+            DisableCursor();
+        }
+        
+        if(GetMouseY() < 0) {
+            SetMousePosition(0, 0);
+        } else if(GetMouseY() > 720) {
+            SetMousePosition(0, 720);
+        }
+
+        //Check if players are off-screen
+        if (Player.Y < 0) {
+            Player.Y = 0;
+        } else if (Player.Y > 480) {
+            Player.Y = 480;
+        }
+
+            // Collision
+        ball(&Player.HitBox, NULL, &Ball, &Player.Score, NULL);
+            //Updates hitbox with player's position.
+        Player.HitBox.y = Player.Y;
 
         // End Game
         if(Ball.X < 0 || IsKeyPressed(KEY_Q)) {
@@ -160,7 +160,7 @@ void marathon_main() {
         BeginDrawing();
 		ClearBackground(BLACK);
 		BeginMode2D(MainCamera);
-                DrawRectangle(0, 0, 1280, 720, (Color){20, 20, 20, 255});
+            DrawRectangle(0, 0, 1280, 720, (Color){20, 20, 20, 255});
 			DrawTexture(PaddleSprite, 0, Player.Y, WHITE);
 			DrawTexture(BallSprite, Ball.X, Ball.Y, WHITE);
 			DrawText(PlayerScore, 0, 0, 32, BLUE);