Changeset 8105 for code/branches/tetris/src/modules/pong/PongBat.cc
- Timestamp:
- Mar 23, 2011, 12:13:34 PM (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/tetris/src/modules/pong/PongBat.cc
r5781 r8105 27 27 */ 28 28 29 /** 30 @file PongBat.cc 31 @brief Implementation of the PongBat class. 32 */ 33 29 34 #include "PongBat.h" 30 35 … … 36 41 CreateFactory(PongBat); 37 42 43 /** 44 @brief 45 Constructor. Registers and initializes the object. 46 */ 38 47 PongBat::PongBat(BaseObject* creator) : ControllableEntity(creator) 39 48 { … … 50 59 } 51 60 61 /** 62 @brief 63 Registers variables to be synchronized over the network. 64 */ 52 65 void PongBat::registerVariables() 53 66 { … … 57 70 } 58 71 72 /** 73 @brief 74 Is called each tick. 75 //TODO detailed 76 @param dt 77 The time since last tick. 78 */ 59 79 void PongBat::tick(float dt) 60 80 { 81 // If the bat is controlled (but not over the network). 61 82 if (this->hasLocalController()) 62 83 { 63 84 if (this->movement_ != 0) 64 85 { 86 // The absolute value of the movement is restricted to be lesser or equal than the speed of the bat. 65 87 this->movement_ = clamp(this->movement_, -1.0f, 1.0f) * this->speed_; 66 88 89 //TODO What does this? 67 90 if (this->bMoveLocal_) 68 91 this->setVelocity(this->getOrientation() * Vector3(this->movement_, 0, 0)); … … 84 107 SUPER(PongBat, tick, dt); 85 108 109 // Restrict the position of the bats, for them to always be between the upper and lower delimiters. i.e. the bats stall if they reach the upper or lower boundary. 86 110 Vector3 position = this->getPosition(); 87 111 if (position.z > this->fieldHeight_ / 2 - this->fieldHeight_ * this->length_ / 2) … … 96 120 } 97 121 122 /** 123 @brief 124 Overloaded the function to steer the bat up and down. 125 @param value 126 A vector whose first component is the inverse direction in which we want to steer the bat. 127 */ 98 128 void PongBat::moveFrontBack(const Vector2& value) 99 129 { … … 102 132 } 103 133 134 /** 135 @brief 136 Overloaded the function to steer the bat up and down. 137 @param value 138 A vector whose first component is the direction in which we wnat to steer the bat. 139 */ 104 140 void PongBat::moveRightLeft(const Vector2& value) 105 141 { … … 108 144 } 109 145 146 /** 147 @brief 148 Is called when the player changed. 149 */ 110 150 void PongBat::changedPlayer() 111 151 {
Note: See TracChangeset
for help on using the changeset viewer.