Changeset 8895
- Timestamp:
- Oct 13, 2011, 8:59:27 PM (13 years ago)
- Location:
- code/branches/gamecontent/src/modules/pong
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/gamecontent/src/modules/pong/Pong.cc
r8858 r8895 39 39 40 40 #include "gamestates/GSLevel.h" 41 #include "chat/ChatManager.h" 41 42 42 43 #include "PongCenterpoint.h" … … 45 46 #include "PongBot.h" 46 47 #include "PongAI.h" 47 48 48 namespace orxonox 49 49 { … … 75 75 // Set the type of Bots for this particular Gametype. 76 76 this->botclass_ = Class(PongBot); 77 this->scoreLimit_ = 3; //TODO: 21 77 78 } 78 79 … … 280 281 } 281 282 283 // If a palyer gets 21 points, he won the game -> end of game 284 285 PlayerInfo* player1 = this->getLeftPlayer(); 286 PlayerInfo* player2 = this->getRightPlayer(); 287 if(player1==NULL||player2==NULL) return; //safety 288 if(this->getScore(player1) >= scoreLimit_) 289 { 290 std::string name1=player1->getName(); 291 std::string message(name1 + " has won!"); 292 ChatManager::message(message); 293 this->end(); 294 } 295 else if(this->getScore(player2) >= scoreLimit_) 296 { 297 std::string name2=player2->getName(); 298 std::string message2(name2 + " has won!"); 299 ChatManager::message(message2); 300 this->end(); 301 } 282 302 // Restart the timer to start the ball. 283 303 this->starttimer_.startTimer(); 304 284 305 } 285 306 -
code/branches/gamecontent/src/modules/pong/Pong.h
r8351 r8895 94 94 WeakPtr<PongBall> ball_; //!< The Pong ball. 95 95 WeakPtr<PongBat> bat_[2]; //!< The two bats. 96 Timer starttimer_; //!< A timer to delay the start of the game. 96 Timer starttimer_; //!< A timer to delay the start of the game. 97 int scoreLimit_; //!< If a player scored that much points, the game is ended. 97 98 }; 98 99 } -
code/branches/gamecontent/src/modules/pong/PongAI.h
r8108 r8895 80 80 void delayedMove(); //!< Is called, when a delayed move takes effect. 81 81 82 PongBall* ball_; //!< Apointer to the ball.82 WeakPtr<PongBall> ball_; //!< A weak pointer to the ball. 83 83 Vector2 ballDirection_; //!< Vector to store the (x,z) direction in which the ball is flying. 84 84 float ballEndPosition_; //!< The calculated end position of the ball.
Note: See TracChangeset
for help on using the changeset viewer.