Changeset 8106 for code/branches/tetris/src/modules/pong
- Timestamp:
- Mar 23, 2011, 6:22:47 PM (14 years ago)
- Location:
- code/branches/tetris/src/modules/pong
- Files:
-
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/tetris/src/modules/pong/Pong.cc
r8104 r8106 37 37 #include "core/EventIncludes.h" 38 38 #include "core/command/Executor.h" 39 40 #include "gamestates/GSLevel.h" 39 41 40 42 #include "PongCenterpoint.h" … … 158 160 this->ball_->setBats(this->bat_); 159 161 } 160 else // If no centerpoint was specified, an error is thrown .162 else // If no centerpoint was specified, an error is thrown and the level is exited. 161 163 { 162 164 COUT(1) << "Error: No Centerpoint specified." << std::endl; 163 // TODO: End the game? 165 GSLevel::startMainMenu(); 166 return; 164 167 } 165 168 … … 210 213 Spawns the input player. 211 214 @param player 212 The player t pbe spawned.215 The player to be spawned. 213 216 */ 214 217 void Pong::spawnPlayer(PlayerInfo* player) -
code/branches/tetris/src/modules/pong/Pong.h
r8105 r8106 47 47 /** 48 48 @brief 49 Implements a Pong minigame .49 Implements a Pong minigame (<a href="http://en.wikipedia.org/wiki/Pong">Wikipedia::Pong</a>). 50 50 It connects the different entities present in a game of Pong. 51 52 //TODO: List and add details to different classes used and how. 53 PongBall, is the ball, PongBats are the things that can be moved by the players (ControllableEntities), PongCenterpoint is the playing field. (x-z area) 51 52 - The @ref orxonox::PongCenterpoint "PongCenterpoint" is the playing field for the Pong minigame, it allows for configuration of the minigame, e.g. by setting the size of the playing field, or the length of the @ref orxonox::PongBat "PongBats". The playing field is always in the x,y-plane, the x-axis being the horizontal and the z-axis being the vertical axis.<br /> 53 The Pong class redistributes the important parameters defined in @ref orxonox::PongCenterpoint "PongCenterpoint" to the other entities, that need to know them, e.g. the @ref orxonox::PongBall "PongBall" and the @ref orxonox::PongBat "PongBats".<br /> 54 The @ref orxonox::PongCenterpoint "PongCenterpoint" needs to exist in a level with the @ref orxonox::Gametype "Gametype" <em>Pong</em>. 55 - The @ref orxonox::PongBall "PongBall" is the ball both players play with. The @ref orxonox::PongBall "PongBall" both implements the movement of the ball, as well as the influence of the boundaries and consequently, also the bouncing (off the upper and lower delimiters, and as off the @ref orxonox::PongBat "PongBats") of the ball and the effects of the failure of a player to catch the ball (i.e. the scoring of the other player). 56 - The two @ref orxonox::PongBat "PongBats" are the entities through which the players can actively participate in the game, by controlling them. The @ref orxonox::PongBat "PongBat" class manages the movement (and restrictions thereof) and the influence of the players on the bats. 54 57 55 58 @author -
code/branches/tetris/src/modules/pong/PongBall.cc
r8105 r8106 144 144 // Set the ball to be exactly at the boundary. 145 145 position.x = this->fieldWidth_ / 2; 146 // Invert its velo xity in x-direction (i.e. it bounces off).146 // Invert its velocity in x-direction (i.e. it bounces off). 147 147 velocity.x = -velocity.x; 148 148 // Adjust the velocity in the z-direction, depending on where the ball hit the bat. … … 171 171 // Set the ball to be exactly at the boundary. 172 172 position.x = -this->fieldWidth_ / 2; 173 // Invert its velo xity in x-direction (i.e. it bounces off).173 // Invert its velocity in x-direction (i.e. it bounces off). 174 174 velocity.x = -velocity.x; 175 175 // Adjust the velocity in the z-direction, depending on where the ball hit the bat. -
code/branches/tetris/src/modules/pong/PongBall.h
r8105 r8106 121 121 void applyBats(); //!< Get the bats over the network. 122 122 123 // TODO: What is this exactly?124 123 static const float MAX_REL_Z_VELOCITY; 125 124 … … 133 132 float batlength_; //!< The length of the bats (in z-direction) as percentage of the height of the playing field. 134 133 WeakPtr<PongBat>* bat_; //!< An array with the two bats. 135 bool bDeleteBats_; //!< Bool, to keep track, of whether bat_ exists or not.134 bool bDeleteBats_; //!< Bool, to keep track, of whether this->bat_ exists or not. 136 135 unsigned int* batID_; //!< The object IDs of the bats, to be able to synchronize them over the network. 137 136 float relMercyOffset_; //!< Offset, that makes the player not loose, when, in all fairness, he would have. -
code/branches/tetris/src/modules/pong/PongBat.cc
r8105 r8106 73 73 @brief 74 74 Is called each tick. 75 //TODO detailed75 Moves the bat. 76 76 @param dt 77 77 The time since last tick. … … 87 87 this->movement_ = clamp(this->movement_, -1.0f, 1.0f) * this->speed_; 88 88 89 //TODO What does this?89 //TODO: Why needed? 90 90 if (this->bMoveLocal_) 91 91 this->setVelocity(this->getOrientation() * Vector3(this->movement_, 0, 0)); … … 96 96 this->bSteadiedPosition_ = false; 97 97 } 98 // If there is no movement but the position has not been steadied, the velocity is set to zero and the position is reaffirmed. 98 99 else if (!this->bSteadiedPosition_) 99 100 { -
code/branches/tetris/src/modules/pong/PongBat.h
r8105 r8106 45 45 /** 46 46 @brief 47 The PongBat class manages the bats for @ref orxonox::Pong "Pong", which are the elements controlled by the player .48 47 The PongBat class manages the bats for @ref orxonox::Pong "Pong", which are the elements controlled by the players. 48 49 49 It is responsible for the movement (controlled by the players) of the bat. 50 50 51 51 @author 52 52 Fabian 'x3n' Landau 53 53 54 54 @ingroup Pong 55 55 */ … … 110 110 111 111 float movement_; //!< The amount (and direction), in z-direction, of movement of the bat. 112 bool bMoveLocal_; // TODO ???113 float speed_; //!< The movement speed of the bat.112 bool bMoveLocal_; //!< Helper to know whether the movement is caused by moveFrontBack() or moveRightLeft(). 113 float speed_; //!< The movement speed of the bat. 114 114 float length_; //!< The length of the bat (in z-direction) as percentage of the height of the playing field. 115 115 float fieldHeight_; //!< The height of the playing field. 116 bool bSteadiedPosition_; // TODO: ???116 bool bSteadiedPosition_; //!< Helper boolean, to keep track of when to steady the position, to ensure network synchronicity. 117 117 }; 118 118 } -
code/branches/tetris/src/modules/pong/PongCenterpoint.h
r8105 r8106 56 56 - The <b>balltemplate</b> is a template that is applied to the @ref orxonox::PongBall "PongBall", it can be used to attach different things to it, e.g. its @ref orxonox::Model "Model". See below for a usage example. 57 57 - The <b>battemplate</b> is a template that is applied to the @ref orxonox::PongBall "PongBat", it can be used to attach different things to it, e.g. its @ref orxonox::Model "Model". See below for a usage example. 58 - The <b>ballspeed</b> is the speed with w ich the @ref orxonox::PongBall "PongBall" moves. The default is <em>100</em>.58 - The <b>ballspeed</b> is the speed with which the @ref orxonox::PongBall "PongBall" moves. The default is <em>100</em>. 59 59 - The <b>ballaccfactor</b> is the acceleration factor for the @ref orxonox::PongBall "PongBall". The default is <em>1.0</em>. 60 60 - The <b>batspeed</b> is the speed with which the @ref orxonox::PongBat "PongBats" move. The default is <em>60</em>. … … 223 223 224 224 std::string balltemplate_; //!< The template for the ball. 225 std::string battemplate_; //!< The template for the bat ts.225 std::string battemplate_; //!< The template for the bats. 226 226 227 227 float ballspeed_; //!< The speed of then ball. -
code/branches/tetris/src/modules/pong/PongScore.h
r5781 r8106 27 27 */ 28 28 29 /** 30 @file PongScore.h 31 @brief Declaration of the PongScore class. 32 @ingroup Pong 33 */ 34 29 35 #ifndef _PongScore_H__ 30 36 #define _PongScore_H__ … … 37 43 namespace orxonox 38 44 { 45 46 /** 47 48 */ 39 49 class _PongExport PongScore : public OverlayText, public Tickable 40 50 {
Note: See TracChangeset
for help on using the changeset viewer.