about summary refs log tree commit diff stats
path: root/src/versus.c
diff options
context:
space:
mode:
authorCharadon <dev@iotib.net>2022-06-02 13:35:28 -0400
committerCharadon <dev@iotib.net>2022-06-02 13:35:28 -0400
commit8d19dc629bb1638990f7f9268880d7a139678a8e (patch)
tree124b527e5e48fc8f441a1273565a60501bf47e19 /src/versus.c
parente372341eb2d92ee7df6fcaf43f4dc2a27967e390 (diff)
downloadPong-C-8d19dc629bb1638990f7f9268880d7a139678a8e.tar.gz
Added music and almost done marathon mode.
Diffstat (limited to 'src/versus.c')
-rw-r--r--src/versus.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/src/versus.c b/src/versus.c
index a5c1060..ed933e5 100644
--- a/src/versus.c
+++ b/src/versus.c
@@ -1,4 +1,5 @@
 #include "pong.h"
+#include "raylib.h"
 
 void versus_main() {
     // Init Player Variables
@@ -19,6 +20,11 @@ void versus_main() {
 	Ball.Direction = LEFT;
 	Ball.Speed = 3.0f;
 	Ball.Angle = 0.0f;
+
+	// Init music
+	Music Background = LoadMusicStream("resources/versus.wav");
+	Background.looping = true;
+	PlayMusicStream(Background);
     
     // Set Sprites
 	Texture2D PaddleSprite = LoadTexture("resources/paddle.png");
@@ -31,12 +37,13 @@ void versus_main() {
 	Enemy.BallDetector = (Rectangle){0, Enemy.Y+120, 1280, PaddleSprite.height/5.0f};
     char EnemyScore[50];
     char PlayerScore[50]; // Used later to display score on screen.
-        // Init Camera
+    // Init Camera
     Camera2D MainCamera;
         MainCamera.target = (Vector2){0, 0};
         MainCamera.offset = (Vector2){0, 0};
         MainCamera.rotation = 0;
     while(!WindowShouldClose() && GameGoing == true) {
+		UpdateMusicStream(Background);
 		MainCamera.zoom = GetScreenHeight()/720.0f;
 		MainCamera.offset = (Vector2){GetScreenWidth()/2.0f, GetScreenHeight()/2.0f};
 		MainCamera.target = (Vector2){1280/2.0f, 720/2.0f};