Changeset 9085 for code/branches/pCuts/src/modules/tetris/Tetris.cc
- Timestamp:
- Apr 13, 2012, 5:44:29 PM (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/pCuts/src/modules/tetris/Tetris.cc
r9084 r9085 99 99 { 100 100 this->activeBrick_->setVelocity(Vector3::ZERO); 101 this->activeBrick_->releaseStones(this->center_); 102 //delete this->activeBrick_; //releasing the memory 101 103 this->createBrick(); 102 104 this->startBrick(); … … 120 122 121 123 const Vector3& currentStonePosition = (*it)->getPosition(); //!< Saves the position of the currentStone 124 orxout()<< "position.x: " << position.x << endl; 125 orxout()<< "currentStonePosition.x: " << currentStonePosition.x << endl; 126 if(position.x == currentStonePosition.x) 127 orxout()<< "NON Valid Move Candidate" <<endl; 122 128 123 129 if((position.x == currentStonePosition.x) && abs(position.y-currentStonePosition.y) < this->center_->getStoneSize()) … … 145 151 stonePosition = rotateVector(stone->getPosition(), brick->getRotationCount()); 146 152 147 /*orxout()<< "stoneRelativePoistion: " << stonePosition << endl;148 orxout()<< "stoneTotalPoistion : " << position + stonePosition << endl;*/149 150 153 if(! this->isValidMove(stone, position + stonePosition )) // wrong position?? 151 154 { … … 168 171 if(this->activeBrick_->contains(*it)) 169 172 continue; 170 //TODO: is this rotation correct ?? 171 Vector3 currentStonePosition = rotateVector((*it)->getPosition(), this->activeBrick_->getRotationCount());173 //Vector3 currentStonePosition = rotateVector((*it)->getPosition(), this->activeBrick_->getRotationCount()); 174 const Vector3& currentStonePosition = (*it)->getPosition(); //!< Saves the position of the currentStone 172 175 //!< Saves the position of the currentStone 176 if(position.x == currentStonePosition.x) 177 { 178 orxout()<< "candidate found" << endl; 179 orxout()<< "position.y: "<< position.y << endl; 180 orxout()<< "urrentStonePosition.y: " << currentStonePosition.y << endl; 181 } 173 182 174 183 if((position.x == currentStonePosition.x) && (position.y < currentStonePosition.y + this->center_->getStoneSize())) 175 184 {//TODO: Why are such events not detected ?? 185 // Because currentStonePosition.x isn't calculated globally, but locally 176 186 orxout()<< "YEAY !!"<<endl; 177 187 this->activeBrick_->setPosition(Vector3(this->activeBrick_->getPosition().x, currentStonePosition.y+this->center_->getStoneSize(), this->activeBrick_->getPosition().z)); … … 207 217 /** 208 218 @brief 209 Nasty function that allocates memory!! it rolls a vector 90° * amount219 A Vector3 is rolled 90 * degrees * amount (anticlockwise rotation) 210 220 */ 211 221 Vector3 Tetris::rotateVector(Vector3 position, unsigned int amount) 212 222 { 213 214 223 int temp = 0; 215 224 for(unsigned int i = 0; i < amount; i++) … … 230 239 if (this->center_ != NULL) // There needs to be a TetrisCenterpoint, i.e. the area the game takes place. 231 240 { 232 // Create the first stone.241 // Create the first brick. 233 242 this->createBrick(); 234 243 }
Note: See TracChangeset
for help on using the changeset viewer.