]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Complete pong goal logic with other teams
authorMattia Basaglia <mattia.basaglia@gmail.com>
Thu, 12 Feb 2015 09:18:05 +0000 (10:18 +0100)
committerMattia Basaglia <mattia.basaglia@gmail.com>
Thu, 12 Feb 2015 09:18:05 +0000 (10:18 +0100)
qcsrc/common/minigames/minigame/pong.qc

index a963f02626a49df5c44ca6987c7c781ff46017b9..c4df2ba33881603c50d5c1ab9d43f3471b573f60 100644 (file)
@@ -100,15 +100,25 @@ void pong_ball_think()
        
        self.origin_x += self.velocity_x * think_speed;
        self.origin_y += self.velocity_y * think_speed;
+       
+       // TODO consider the ball's radius (and add cvar for that)
        if ( self.origin_y <= 0 )
        {
-               self.origin_y = 0;
-               self.velocity_y *= -1;
+               if ( !pong_goal(self,3) )
+               {
+                       self.origin_y = 0;
+                       self.velocity_y *= -1;
+                       self.team = 3;
+               }
        }
        else if ( self.origin_y >= 1 )
        {
-               self.origin_y = 1;
-               self.velocity_y *= -1;
+               if ( !pong_goal(self,4) )
+               {
+                       self.origin_y = 1;
+                       self.velocity_y *= -1;
+                       self.team = 4;
+               }
        }
        
        if ( self.origin_x <= 0 )
@@ -129,7 +139,6 @@ void pong_ball_think()
                         self.team = 1;
                }
        }
-       // TODO team 3 4 goal check
        
        self.SendFlags |= MINIG_SF_UPDATE;
 }