Changeset 6412 for code/branches/pickup2/src/modules/pong
- Timestamp:
- Dec 25, 2009, 1:18:03 PM (15 years ago)
- Location:
- code/branches/pickup2
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/pickup2
- Property svn:mergeinfo changed
-
code/branches/pickup2/src/modules/pong/Pong.cc
r5929 r6412 42 42 CreateEventName(PongCenterpoint, right); 43 43 CreateEventName(PongCenterpoint, left); 44 44 45 45 CreateUnloadableFactory(Pong); 46 46 … … 164 164 else if (player == this->getLeftPlayer()) 165 165 this->center_->fireEvent(FireEventName(PongCenterpoint, left)); 166 166 167 167 if (player) 168 168 this->gtinfo_->sendAnnounceMessage(player->getName() + " scored"); -
code/branches/pickup2/src/modules/pong/PongAI.cc
r5929 r6412 62 62 { 63 63 for (std::list<std::pair<Timer*, char> >::iterator it = this->reactionTimers_.begin(); it != this->reactionTimers_.end(); ++it) 64 (*it).first->destroy();64 it->first->destroy(); 65 65 } 66 66 … … 131 131 this->bOscillationAvoidanceActive_ = false; 132 132 } 133 133 134 134 // If the ball is close enough, calculate another random offset to accelerate the ball 135 135 if (!this->bChangedRandomOffset_) … … 206 206 // calculate the time until the ball reaches the other side 207 207 float totaltime = (-position.x + dimension.x / 2 * sgn(velocity.x)) / velocity.x; 208 208 209 209 // calculate wall bounce position (four possible solutions of the equation: pos.z + vel.z*t + acc.z/2*t^2 = +/- dim.z/2) 210 210 float bouncetime = totaltime; 211 211 bool bUpperWall = false; 212 212 213 213 if (acceleration.z == 0) 214 214 { … … 270 270 // ball bounces after <bouncetime> seconds, update the position and continue 271 271 velocity.z = velocity.z + acceleration.z * bouncetime; 272 272 273 273 if (bUpperWall) 274 274 { … … 281 281 velocity.z = fabs(velocity.z) - fabs(randomErrorZ); 282 282 } 283 283 284 284 position.x = position.x + velocity.x * bouncetime + randomErrorX; 285 285 this->ballEndPosition_ = position.z; -
code/branches/pickup2/src/modules/pong/PongBall.cc
r5929 r6412 105 105 velocity.z = distance * distance * sgn(distance) * PongBall::MAX_REL_Z_VELOCITY * this->speed_; 106 106 acceleration = this->bat_[1]->getVelocity() * this->accelerationFactor_ * -1; 107 107 108 108 this->fireEvent(); 109 109 } -
code/branches/pickup2/src/modules/pong/PongScore.cc
r5929 r6412 77 77 std::string name2; 78 78 79 std::string score1 = "0";80 std::string score2 = "0";79 std::string score1("0"); 80 std::string score2("0"); 81 81 82 82 if (player1) … … 114 114 } 115 115 116 std::string output = "PONG";116 std::string output("PONG"); 117 117 if (this->bShowName_ || this->bShowScore_) 118 118 { 119 119 if (this->bShowLeftPlayer_ && this->bShowRightPlayer_) 120 output = output1 + ":"+ output2;120 output = output1 + ':' + output2; 121 121 else if (this->bShowLeftPlayer_ || this->bShowRightPlayer_) 122 122 output = output1 + output2;
Note: See TracChangeset
for help on using the changeset viewer.